You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
5.1 KiB
1 line
5.1 KiB
{"ast":null,"code":"import _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\nimport { useEffect } from 'react';\nimport ExpoKeepAwake from \"./ExpoKeepAwake\";\nexport var ExpoKeepAwakeTag = 'ExpoKeepAwakeDefaultTag';\nexport function useKeepAwake() {\n var tag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ExpoKeepAwakeTag;\n var options = arguments.length > 1 ? arguments[1] : undefined;\n useEffect(function () {\n activateKeepAwake(tag);\n return function () {\n if (options != null && options.suppressDeactivateWarnings) {\n deactivateKeepAwake(tag).catch(function () {});\n } else {\n deactivateKeepAwake(tag);\n }\n };\n }, [tag]);\n}\nexport function activateKeepAwake() {\n return _activateKeepAwake.apply(this, arguments);\n}\nfunction _activateKeepAwake() {\n _activateKeepAwake = _asyncToGenerator(function* () {\n var tag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ExpoKeepAwakeTag;\n yield ExpoKeepAwake.activate == null ? void 0 : ExpoKeepAwake.activate(tag);\n });\n return _activateKeepAwake.apply(this, arguments);\n}\nexport function deactivateKeepAwake() {\n return _deactivateKeepAwake.apply(this, arguments);\n}\nfunction _deactivateKeepAwake() {\n _deactivateKeepAwake = _asyncToGenerator(function* () {\n var tag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ExpoKeepAwakeTag;\n yield ExpoKeepAwake.deactivate == null ? void 0 : ExpoKeepAwake.deactivate(tag);\n });\n return _deactivateKeepAwake.apply(this, arguments);\n}","map":{"version":3,"mappings":";AAAA,SAASA,SAAS,QAAQ,OAAO;AAEjC,OAAOC,aAAa;AAEpB,OAAO,IAAMC,gBAAgB,GAAG,yBAAyB;AAgBzD,OAAM,SAAUC,YAAY,GAIzB;EAAA,IAHDC,0EAAcF,gBAAgB;EAAA,IAC9BG,OAEC;EAEDL,SAAS,CAAC,YAAK;IACbM,iBAAiB,CAACF,GAAG,CAAC;IACtB,OAAO,YAAK;MACV,IAAIC,OAAO,YAAPA,OAAO,CAAEE,0BAA0B,EAAE;QACvCC,mBAAmB,CAACJ,GAAG,CAAC,CAACK,KAAK,CAAC,YAAK,CAAE,CAAC,CAAC;OACzC,MAAM;QACLD,mBAAmB,CAACJ,GAAG,CAAC;;IAE5B,CAAC;EACH,CAAC,EAAE,CAACA,GAAG,CAAC,CAAC;AACX;AAYA,gBAAsBE,iBAAiB;EAAA;AAAA;AAEtC;EAAA,uCAFM,aAA+D;IAAA,IAA9BF,0EAAcF,gBAAgB;IACpE,MAAMD,aAAa,CAACS,QAAQ,oBAAtBT,aAAa,CAACS,QAAQ,CAAGN,GAAG,CAAC;EACrC,CAAC;EAAA;AAAA;AASD,gBAAsBI,mBAAmB;EAAA;AAAA;AAExC;EAAA,yCAFM,aAAiE;IAAA,IAA9BJ,0EAAcF,gBAAgB;IACtE,MAAMD,aAAa,CAACU,UAAU,oBAAxBV,aAAa,CAACU,UAAU,CAAGP,GAAG,CAAC;EACvC,CAAC;EAAA;AAAA","names":["useEffect","ExpoKeepAwake","ExpoKeepAwakeTag","useKeepAwake","tag","options","activateKeepAwake","suppressDeactivateWarnings","deactivateKeepAwake","catch","activate","deactivate"],"sources":["/Users/mathildejean/Documents/BUT/LaSuperMeteo/LaSuperMeteo/iut-expo-starter/node_modules/expo-keep-awake/src/index.ts"],"sourcesContent":["import { useEffect } from 'react';\n\nimport ExpoKeepAwake from './ExpoKeepAwake';\n\nexport const ExpoKeepAwakeTag = 'ExpoKeepAwakeDefaultTag';\n\n// @needsAudit\n/**\n * A React hook to keep the screen awake for as long as the owner component is mounted.\n * The optionally provided `tag` argument is used when activating and deactivating the keep-awake\n * feature. If unspecified, the default `tag` is used. See the documentation for `activateKeepAwake`\n * below to learn more about the `tag` argument.\n *\n * @param tag *Optional* - Tag to lock screen sleep prevention. If not provided, the default tag is used.\n * @param options *Optional*\n * - `suppressDeactivateWarnings` *Optional* -\n * The call will throw an unhandled promise rejection on Android\n * when the original Activity is dead or deactivated.\n * Set the value to true for suppressing the uncaught exception.\n */\nexport function useKeepAwake(\n tag: string = ExpoKeepAwakeTag,\n options?: {\n suppressDeactivateWarnings: boolean;\n }\n): void {\n useEffect(() => {\n activateKeepAwake(tag);\n return () => {\n if (options?.suppressDeactivateWarnings) {\n deactivateKeepAwake(tag).catch(() => {});\n } else {\n deactivateKeepAwake(tag);\n }\n };\n }, [tag]);\n}\n\n// @needsAudit\n/**\n * Prevents the screen from sleeping until `deactivateKeepAwake` is called with the same `tag` value.\n *\n * If the `tag` argument is specified, the screen will not sleep until you call `deactivateKeepAwake`\n * with the same `tag` argument. When using multiple `tags` for activation you'll have to deactivate\n * each one in order to re-enable screen sleep. If tag is unspecified, the default `tag` is used.\n * @param tag *Optional* - Tag to lock screen sleep prevention. If not provided, the default tag is used.\n */\n\nexport async function activateKeepAwake(tag: string = ExpoKeepAwakeTag): Promise<void> {\n await ExpoKeepAwake.activate?.(tag);\n}\n\n// @needsAudit\n/**\n * Releases the lock on screen-sleep prevention associated with the given `tag` value. If `tag`\n * is unspecified, it defaults to the same default tag that `activateKeepAwake` uses.\n * @param tag *Optional* - Tag to release the lock on screen sleep prevention. If not provided,\n * the default tag is used.\n */\nexport async function deactivateKeepAwake(tag: string = ExpoKeepAwakeTag): Promise<void> {\n await ExpoKeepAwake.deactivate?.(tag);\n}\n"]},"metadata":{},"sourceType":"module","externalDependencies":[]} |