UNPKG

repoweaver

Version:

A GitHub App that skillfully weaves multiple templates together to create and update repositories with intelligent merge strategies

1 lines 10.7 kB
{"ast":null,"code":"import _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\nimport { UnavailabilityError } from 'expo-modules-core';\nimport { useEffect } from 'react';\nimport ExpoKeepAwake from \"./ExpoKeepAwake\";\nexport var ExpoKeepAwakeTag = 'ExpoKeepAwakeDefaultTag';\nexport function isAvailableAsync() {\n return _isAvailableAsync.apply(this, arguments);\n}\nfunction _isAvailableAsync() {\n _isAvailableAsync = _asyncToGenerator(function* () {\n if (ExpoKeepAwake.isAvailableAsync) {\n return yield ExpoKeepAwake.isAvailableAsync();\n }\n return true;\n });\n return _isAvailableAsync.apply(this, arguments);\n}\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 var isMounted = true;\n activateKeepAwakeAsync(tag).then(function () {\n if (isMounted && ExpoKeepAwake.addListenerForTag && options != null && options.listener) {\n addListener(tag, options.listener);\n }\n });\n return function () {\n isMounted = false;\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 var tag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ExpoKeepAwakeTag;\n console.warn('`activateKeepAwake` is deprecated. Use `activateKeepAwakeAsync` instead.');\n return activateKeepAwakeAsync(tag);\n}\nexport function activateKeepAwakeAsync() {\n return _activateKeepAwakeAsync.apply(this, arguments);\n}\nfunction _activateKeepAwakeAsync() {\n _activateKeepAwakeAsync = _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 _activateKeepAwakeAsync.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}\nexport function addListener(tagOrListener, listener) {\n if (!ExpoKeepAwake.addListenerForTag) {\n throw new UnavailabilityError('ExpoKeepAwake', 'addListenerForTag');\n }\n var tag = typeof tagOrListener === 'string' ? tagOrListener : ExpoKeepAwakeTag;\n var _listener = typeof tagOrListener === 'function' ? tagOrListener : listener;\n return ExpoKeepAwake.addListenerForTag(tag, _listener);\n}\nexport * from \"./KeepAwake.types\";","map":{"version":3,"names":["UnavailabilityError","useEffect","ExpoKeepAwake","ExpoKeepAwakeTag","isAvailableAsync","_isAvailableAsync","apply","arguments","_asyncToGenerator","useKeepAwake","tag","length","undefined","options","isMounted","activateKeepAwakeAsync","then","addListenerForTag","listener","addListener","suppressDeactivateWarnings","deactivateKeepAwake","catch","activateKeepAwake","console","warn","_activateKeepAwakeAsync","activate","_deactivateKeepAwake","deactivate","tagOrListener","_listener"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/expo-keep-awake/src/index.ts"],"sourcesContent":["import { Subscription, UnavailabilityError } from 'expo-modules-core';\nimport { useEffect } from 'react';\n\nimport ExpoKeepAwake from './ExpoKeepAwake';\nimport { KeepAwakeListener, KeepAwakeOptions } from './KeepAwake.types';\n\n/** Default tag, used when no tag has been specified in keep awake method calls. */\nexport const ExpoKeepAwakeTag = 'ExpoKeepAwakeDefaultTag';\n\n/** @returns `true` on all platforms except [unsupported web browsers](https://caniuse.com/wake-lock). */\nexport async function isAvailableAsync(): Promise<boolean> {\n if (ExpoKeepAwake.isAvailableAsync) {\n return await ExpoKeepAwake.isAvailableAsync();\n }\n return true;\n}\n\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 `activateKeepAwakeAsync`\n * below to learn more about the `tag` argument.\n *\n * @param tag Tag to lock screen sleep prevention. If not provided, the default tag is used.\n * @param options Additional options for the keep awake hook.\n */\nexport function useKeepAwake(tag: string = ExpoKeepAwakeTag, options?: KeepAwakeOptions): void {\n useEffect(() => {\n let isMounted = true;\n activateKeepAwakeAsync(tag).then(() => {\n if (isMounted && ExpoKeepAwake.addListenerForTag && options?.listener) {\n addListener(tag, options.listener);\n }\n });\n return () => {\n isMounted = false;\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 *\n * Web support [is limited](https://caniuse.com/wake-lock).\n *\n * @param tag Tag to lock screen sleep prevention. If not provided, the default tag is used.\n * @deprecated use `activateKeepAwakeAsync` instead.\n */\nexport function activateKeepAwake(tag: string = ExpoKeepAwakeTag): Promise<void> {\n console.warn('`activateKeepAwake` is deprecated. Use `activateKeepAwakeAsync` instead.');\n return activateKeepAwakeAsync(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 *\n * Web support [is limited](https://caniuse.com/wake-lock).\n *\n * @param tag Tag to lock screen sleep prevention. If not provided, the default tag is used.\n */\nexport async function activateKeepAwakeAsync(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 *\n * @param tag 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\n/**\n * Observe changes to the keep awake timer.\n * On web, this changes when navigating away from the active window/tab. No-op on native.\n * @platform web\n *\n * @example\n * ```ts\n * KeepAwake.addListener(({ state }) => {\n * // ...\n * });\n * ```\n */\nexport function addListener(\n tagOrListener: string | KeepAwakeListener,\n listener?: KeepAwakeListener\n): Subscription {\n // Assert so the type is non-nullable.\n if (!ExpoKeepAwake.addListenerForTag) {\n throw new UnavailabilityError('ExpoKeepAwake', 'addListenerForTag');\n }\n\n const tag = typeof tagOrListener === 'string' ? tagOrListener : ExpoKeepAwakeTag;\n const _listener = typeof tagOrListener === 'function' ? tagOrListener : listener;\n\n return ExpoKeepAwake.addListenerForTag(tag, _listener);\n}\n\nexport * from './KeepAwake.types';\n"],"mappings":";AAAA,SAAuBA,mBAAmB,QAAQ,mBAAmB;AACrE,SAASC,SAAS,QAAQ,OAAO;AAEjC,OAAOC,aAAa;AAIpB,OAAO,IAAMC,gBAAgB,GAAG,yBAAyB;AAGzD,gBAAsBC,gBAAgBA,CAAA;EAAA,OAAAC,iBAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAKrC,SAAAF,kBAAA;EAAAA,iBAAA,GAAAG,iBAAA,CALM,aAA+B;IACpC,IAAIN,aAAa,CAACE,gBAAgB,EAAE;MAClC,aAAaF,aAAa,CAACE,gBAAgB,EAAE;;IAE/C,OAAO,IAAI;EACb,CAAC;EAAA,OAAAC,iBAAA,CAAAC,KAA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