UNPKG

11.4 kBSource Map (JSON)View Raw
1{"version":3,"sources":["../../src/utils/api-browser-docs.js"],"names":["exports","onClientEntry","onInitialClientRender","onPreRouteUpdate","onRouteUpdateDelayed","onRouteUpdate","shouldUpdateScroll","registerServiceWorker","replaceComponentRenderer","wrapPageElement","wrapRootElement","onPrefetchPathname","onPostPrefetchPathname","disableCorePrefetching","replaceHydrateFunction","onServiceWorkerInstalled","onServiceWorkerUpdateFound","onServiceWorkerUpdateReady","onServiceWorkerActive","onServiceWorkerRedundant"],"mappings":";;AAAA;;;;;AAKA;;;;;AAKA;;;;;;;;;;AAUAA,OAAO,CAACC,aAAR,GAAwB,IAAxB;AAEA;;;;;;;;;;AASAD,OAAO,CAACE,qBAAR,GAAgC,IAAhC;AAEA;;;;;;;;;;;;;AAYAF,OAAO,CAACG,gBAAR,GAA2B,IAA3B;AAEA;;;;;;;;;;;;AAWAH,OAAO,CAACI,oBAAR,GAA+B,IAA/B;AAEA;;;;;;;;;;;;;AAYAJ,OAAO,CAACK,aAAR,GAAwB,IAAxB;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BAL,OAAO,CAACM,kBAAR,GAA6B,IAA7B;AAEA;;;;;;;;;AAQAN,OAAO,CAACO,qBAAR,GAAgC,IAAhC;AAEA;;;;;;;;;;AASAP,OAAO,CAACQ,wBAAR,GAAmC,IAAnC;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBAR,OAAO,CAACS,eAAR,GAA0B,IAA1B;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BAT,OAAO,CAACU,eAAR,GAA0B,IAA1B;AAEA;;;;;;;;;AAQAV,OAAO,CAACW,kBAAR,GAA6B,IAA7B;AAEA;;;;;;;;AAOAX,OAAO,CAACY,sBAAR,GAAiC,IAAjC;AAEA;;;;;;;;;;AASAZ,OAAO,CAACa,sBAAR,GAAiC,IAAjC;AAEA;;;;;;;;;;;;;;;;AAeAb,OAAO,CAACc,sBAAR,GAAiC,IAAjC;AAEA;;;;;;;AAMAd,OAAO,CAACe,wBAAR,GAAmC,IAAnC;AAEA;;;;;;;AAMAf,OAAO,CAACgB,0BAAR,GAAqC,IAArC;AAEA;;;;;;;;AAOAhB,OAAO,CAACiB,0BAAR,GAAqC,IAArC;AAEA;;;;;;;AAMAjB,OAAO,CAACkB,qBAAR,GAAgC,IAAhC;AAEA;;;;;;;AAMAlB,OAAO,CAACmB,wBAAR,GAAmC,IAAnC","sourcesContent":["/**\n * This argument is empty. This is for consistency so `pluginOptions` is always second argument.\n * @typedef {undefined} emptyArg\n */\n\n/**\n * Object containing options defined in `gatsby-config.js`\n * @typedef {object} pluginOptions\n */\n\n/**\n * Called when the Gatsby browser runtime first starts.\n * @param {emptyArg} _\n * @param {pluginOptions} pluginOptions\n * @example\n * exports.onClientEntry = () => {\n * console.log(\"We've started!\")\n * callAnalyticsAPI()\n * }\n */\nexports.onClientEntry = true\n\n/**\n * Called when the initial (but not subsequent) render of Gatsby App is done on the client.\n * @param {emptyArg} _\n * @param {pluginOptions} pluginOptions\n * @example\n * exports.onInitialClientRender = () => {\n * console.log(\"ReactDOM.render has executed\")\n * }\n */\nexports.onInitialClientRender = true\n\n/**\n * Called when changing location is started.\n * @param {object} $0\n * @param {object} $0.location A location object\n * @param {object|null} $0.prevLocation The previous location object\n * @param {pluginOptions} pluginOptions\n * @example\n * exports.onPreRouteUpdate = ({ location, prevLocation }) => {\n * console.log(\"Gatsby started to change location to\", location.pathname)\n * console.log(\"Gatsby started to change location from\", prevLocation ? prevLocation.pathname : null)\n * }\n */\nexports.onPreRouteUpdate = true\n\n/**\n * Called when changing location is longer than 1 second.\n * @param {object} $0\n * @param {object} $0.location A location object\n * @param {object} $0.action The \"action\" that caused the route change\n * @param {pluginOptions} pluginOptions\n * @example\n * exports.onRouteUpdateDelayed = () => {\n * console.log(\"We can show loading indicator now\")\n * }\n */\nexports.onRouteUpdateDelayed = true\n\n/**\n * Called when the user changes routes\n * @param {object} $0\n * @param {object} $0.location A location object\n * @param {object|null} $0.prevLocation The previous location object\n * @param {pluginOptions} pluginOptions\n * @example\n * exports.onRouteUpdate = ({ location, prevLocation }) => {\n * console.log('new pathname', location.pathname)\n * console.log('old pathname', prevLocation ? prevLocation.pathname : null)\n * }\n */\nexports.onRouteUpdate = true\n\n/**\n * Allows a plugin to influence scrolling behavior on navigation.\n * Default behavior is persisting last known scrolling positions and scrolling back to them on navigation.\n * Plugins can also override this and return an Array of coordinates or an element name to scroll to.\n * @param {object} $0\n * @param {object} $0.prevRouterProps The previous state of the router before the route change.\n * @param {object} $0.routerProps The current state of the router.\n * @param {string} $0.pathname The new pathname (for backwards compatibility with v1).\n * @param {function} $0.getSavedScrollPosition Takes a location and returns the\n * coordinates of the last scroll position for that location, or `null`. Gatsby\n * saves scroll positions for each route in `SessionStorage`, so they are\n * available after page reload.\n * @returns {(boolean|string|Array)} Should return either an [x, y] Array of\n * coordinates to scroll to, a string of the `id` or `name` of an element to\n * scroll to, `false` to not update the scroll position, or `true` for the\n * default behavior.\n * @param {pluginOptions} pluginOptions\n * @example\n * exports.shouldUpdateScroll = ({\n * routerProps: { location },\n * getSavedScrollPosition\n * }) => {\n * const currentPosition = getSavedScrollPosition(location)\n * const queriedPosition = getSavedScrollPosition({ pathname: `/random` })\n *\n * window.scrollTo(...(currentPosition || [0, 0]))\n *\n * return false\n * }\n */\nexports.shouldUpdateScroll = true\n\n/**\n * Allow a plugin to register a Service Worker. Should be a function that returns true.\n * @param {emptyArg} _\n * @param {pluginOptions} pluginOptions\n * @returns {boolean} Should Gatsby register `/sw.js` service worker\n * @example\n * exports.registerServiceWorker = () => true\n */\nexports.registerServiceWorker = true\n\n/**\n * Allow a plugin to replace the page component renderer.\n * @deprecated Use [wrapPageElement](#wrapPageElement) to decorate page element.\n * @param {object} $0\n * @param {object} $0.props The props of the page.\n * @param {object} $0.loader The gatsby loader.\n * @param {pluginOptions} pluginOptions\n * @returns {ReactNode} Replaced default page renderer\n */\nexports.replaceComponentRenderer = true\n\n/**\n * Allow a plugin to wrap the page element.\n *\n * This is useful for setting wrapper components around pages that won't get\n * unmounted on page changes. For setting Provider components, use [wrapRootElement](#wrapRootElement).\n *\n * _Note:_\n * There is an equivalent hook in Gatsby's [SSR API](/docs/ssr-apis/#wrapPageElement).\n * It is recommended to use both APIs together.\n * For example usage, check out [Using i18n](https://github.com/gatsbyjs/gatsby/tree/master/examples/using-i18n).\n * @param {object} $0\n * @param {ReactNode} $0.element The \"Page\" React Element built by Gatsby.\n * @param {object} $0.props Props object used by page.\n * @param {pluginOptions} pluginOptions\n * @returns {ReactNode} Wrapped element\n * @example\n * const React = require(\"react\")\n * const Layout = require(\"./src/components/layout\").default\n *\n * exports.wrapPageElement = ({ element, props }) => {\n * // props provide same data to Layout as Page element will get\n * // including location, data, etc - you don't need to pass it\n * return <Layout {...props}>{element}</Layout>\n * }\n */\nexports.wrapPageElement = true\n\n/**\n * Allow a plugin to wrap the root element.\n *\n * This is useful to set up any Provider components that will wrap your application.\n * For setting persistent UI elements around pages use [wrapPageElement](#wrapPageElement).\n *\n * _Note:_\n * There is an equivalent hook in Gatsby's [SSR API](/docs/ssr-apis/#wrapRootElement).\n * It is recommended to use both APIs together.\n * For example usage, check out [Using redux](https://github.com/gatsbyjs/gatsby/tree/master/examples/using-redux).\n * @param {object} $0\n * @param {ReactNode} $0.element The \"Root\" React Element built by Gatsby.\n * @param {pluginOptions} pluginOptions\n * @returns {ReactNode} Wrapped element\n * @example\n * const React = require(\"react\")\n * const { Provider } = require(\"react-redux\")\n *\n * const createStore = require(\"./src/state/createStore\")\n * const store = createStore()\n *\n * exports.wrapRootElement = ({ element }) => {\n * return (\n * <Provider store={store}>\n * {element}\n * </Provider>\n * )\n * }\n */\nexports.wrapRootElement = true\n\n/**\n * Called when prefetching for a pathname is triggered. Allows\n * for plugins with custom prefetching logic.\n * @param {object} $0\n * @param {string} $0.pathname The pathname whose resources should now be prefetched\n * @param {function} $0.loadPage Function for fetching resources related to pathname\n * @param {pluginOptions} pluginOptions\n */\nexports.onPrefetchPathname = true\n\n/**\n * Called when prefetching for a pathname is successful. Allows\n * for plugins with custom prefetching logic.\n * @param {object} $0\n * @param {string} $0.pathname The pathname whose resources have now been prefetched\n * @param {pluginOptions} pluginOptions\n */\nexports.onPostPrefetchPathname = true\n\n/**\n * Plugins can take over prefetching logic. If they do, they should call this\n * to disable the now duplicate core prefetching logic.\n * @param {emptyArg} _\n * @param {pluginOptions} pluginOptions\n * @returns {boolean} Should disable core prefetching\n * @example\n * exports.disableCorePrefetching = () => true\n */\nexports.disableCorePrefetching = true\n\n/**\n * Allow a plugin to replace the `ReactDOM.render`/`ReactDOM.hydrate` function call by a custom renderer.\n * @param {emptyArg} _\n * @param {pluginOptions} pluginOptions\n * @returns {Function} This method should return a function with same signature as `ReactDOM.render()`\n *\n * _Note:_ it's very important to call the `callback` after rendering, otherwise Gatsby will not be able to call `onInitialClientRender`\n * @example\n * exports.replaceHydrateFunction = () => {\n * return (element, container, callback) => {\n * console.log(\"rendering!\");\n * ReactDOM.render(element, container, callback);\n * };\n * };\n */\nexports.replaceHydrateFunction = true\n\n/**\n * Inform plugins when a service worker has been installed.\n * @param {object} $0\n * @param {object} $0.serviceWorker The service worker instance.\n * @param {pluginOptions} pluginOptions\n */\nexports.onServiceWorkerInstalled = true\n\n/**\n * Inform plugins of when a service worker has an update available.\n * @param {object} $0\n * @param {object} $0.serviceWorker The service worker instance.\n * @param {pluginOptions} pluginOptions\n */\nexports.onServiceWorkerUpdateFound = true\n\n/**\n * Inform plugins when a service worker has been updated in the background\n * and the page is ready to reload to apply changes.\n * @param {object} $0\n * @param {object} $0.serviceWorker The service worker instance.\n * @param {pluginOptions} pluginOptions\n */\nexports.onServiceWorkerUpdateReady = true\n\n/**\n * Inform plugins when a service worker has become active.\n * @param {object} $0\n * @param {object} $0.serviceWorker The service worker instance.\n * @param {pluginOptions} pluginOptions\n */\nexports.onServiceWorkerActive = true\n\n/**\n * Inform plugins when a service worker is redundant.\n * @param {object} $0\n * @param {object} $0.serviceWorker The service worker instance.\n * @param {pluginOptions} pluginOptions\n */\nexports.onServiceWorkerRedundant = true\n"],"file":"api-browser-docs.js"}
\No newline at end of file