queue-run
queue-run copied to clipboard
Prefetch resources
Common usage for warmup is to fetch resources.
-
prefetch.add(url, fetcher?)adds a resource with the URL and immediately starts loading it -
prefetch.get(url)waits for resource to load and returns it - Fetcher function called with the URL, should return an object
- Default behavior: load resource, fail unless 200/304, parse if JSON
- Use with Google OAuth:
prefetch.add(auth.google.prefetch)