7bec810e38e75defc161ec3acbf47c41.json
9.19 KB
{"ast":null,"code":"var _interopRequireDefault=require(\"@babel/runtime/helpers/interopRequireDefault\");Object.defineProperty(exports,\"__esModule\",{value:true});exports.default=void 0;var _ExecutionEnvironment=require(\"fbjs/lib/ExecutionEnvironment\");var _arrayFindIndex=_interopRequireDefault(require(\"array-find-index\"));var _invariant=_interopRequireDefault(require(\"fbjs/lib/invariant\"));function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if(\"value\"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}var isPrefixed=_ExecutionEnvironment.canUseDOM&&!document.hasOwnProperty('hidden')&&document.hasOwnProperty('webkitHidden');var EVENT_TYPES=['change','memoryWarning'];var VISIBILITY_CHANGE_EVENT=isPrefixed?'webkitvisibilitychange':'visibilitychange';var VISIBILITY_STATE_PROPERTY=isPrefixed?'webkitVisibilityState':'visibilityState';var AppStates={BACKGROUND:'background',ACTIVE:'active'};var listeners=[];var AppState=function(){function AppState(){}AppState.addEventListener=function addEventListener(type,handler){if(AppState.isAvailable){(0,_invariant.default)(EVENT_TYPES.indexOf(type)!==-1,'Trying to subscribe to unknown event: \"%s\"',type);if(type==='change'){var callback=function callback(){return handler(AppState.currentState);};listeners.push([handler,callback]);document.addEventListener(VISIBILITY_CHANGE_EVENT,callback,false);}}};AppState.removeEventListener=function removeEventListener(type,handler){if(AppState.isAvailable){(0,_invariant.default)(EVENT_TYPES.indexOf(type)!==-1,'Trying to remove listener for unknown event: \"%s\"',type);if(type==='change'){var listenerIndex=(0,_arrayFindIndex.default)(listeners,function(pair){return pair[0]===handler;});(0,_invariant.default)(listenerIndex!==-1,'Trying to remove AppState listener for unregistered handler');var callback=listeners[listenerIndex][1];document.removeEventListener(VISIBILITY_CHANGE_EVENT,callback,false);listeners.splice(listenerIndex,1);}}};_createClass(AppState,null,[{key:\"currentState\",get:function get(){if(!AppState.isAvailable){return AppStates.ACTIVE;}switch(document[VISIBILITY_STATE_PROPERTY]){case'hidden':case'prerender':case'unloaded':return AppStates.BACKGROUND;default:return AppStates.ACTIVE;}}}]);return AppState;}();exports.default=AppState;AppState.isAvailable=_ExecutionEnvironment.canUseDOM&&document[VISIBILITY_STATE_PROPERTY];","map":{"version":3,"sources":["C:/Users/bluej/Desktop/2_2/searchGuide/searchGuide/node_modules/react-native-web/dist/exports/AppState/index.js"],"names":["_defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","_createClass","Constructor","protoProps","staticProps","prototype","isPrefixed","canUseDOM","document","hasOwnProperty","EVENT_TYPES","VISIBILITY_CHANGE_EVENT","VISIBILITY_STATE_PROPERTY","AppStates","BACKGROUND","ACTIVE","listeners","AppState","addEventListener","type","handler","isAvailable","indexOf","callback","currentState","push","removeEventListener","listenerIndex","pair","splice","get"],"mappings":"mKAaA,mEACA,wEACA,qEAfA,QAASA,CAAAA,iBAAT,CAA2BC,MAA3B,CAAmCC,KAAnC,CAA0C,CAAE,IAAK,GAAIC,CAAAA,CAAC,CAAG,CAAb,CAAgBA,CAAC,CAAGD,KAAK,CAACE,MAA1B,CAAkCD,CAAC,EAAnC,CAAuC,CAAE,GAAIE,CAAAA,UAAU,CAAGH,KAAK,CAACC,CAAD,CAAtB,CAA2BE,UAAU,CAACC,UAAX,CAAwBD,UAAU,CAACC,UAAX,EAAyB,KAAjD,CAAwDD,UAAU,CAACE,YAAX,CAA0B,IAA1B,CAAgC,GAAI,SAAWF,CAAAA,UAAf,CAA2BA,UAAU,CAACG,QAAX,CAAsB,IAAtB,CAA4BC,MAAM,CAACC,cAAP,CAAsBT,MAAtB,CAA8BI,UAAU,CAACM,GAAzC,CAA8CN,UAA9C,EAA4D,CAAE,CAE7T,QAASO,CAAAA,YAAT,CAAsBC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AAjB,CAAZ,CAmBA,MAAOE,CAAAA,QAAP,CACD,CAtDD,EAFA,C,yBA0DAA,QAAQ,CAACI,WAAT,CAAuBd,iCAAaC,QAAQ,CAACI,yBAAD,CAA5C","sourcesContent":["function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n/**\n * Copyright (c) Nicolas Gallagher.\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\nimport { canUseDOM } from 'fbjs/lib/ExecutionEnvironment';\nimport findIndex from 'array-find-index';\nimport invariant from 'fbjs/lib/invariant'; // Android 4.4 browser\n\nvar isPrefixed = canUseDOM && !document.hasOwnProperty('hidden') && document.hasOwnProperty('webkitHidden');\nvar EVENT_TYPES = ['change', 'memoryWarning'];\nvar VISIBILITY_CHANGE_EVENT = isPrefixed ? 'webkitvisibilitychange' : 'visibilitychange';\nvar VISIBILITY_STATE_PROPERTY = isPrefixed ? 'webkitVisibilityState' : 'visibilityState';\nvar AppStates = {\n BACKGROUND: 'background',\n ACTIVE: 'active'\n};\nvar listeners = [];\n\nvar AppState =\n/*#__PURE__*/\nfunction () {\n function AppState() {}\n\n AppState.addEventListener = function addEventListener(type, handler) {\n if (AppState.isAvailable) {\n invariant(EVENT_TYPES.indexOf(type) !== -1, 'Trying to subscribe to unknown event: \"%s\"', type);\n\n if (type === 'change') {\n var callback = function callback() {\n return handler(AppState.currentState);\n };\n\n listeners.push([handler, callback]);\n document.addEventListener(VISIBILITY_CHANGE_EVENT, callback, false);\n }\n }\n };\n\n AppState.removeEventListener = function removeEventListener(type, handler) {\n if (AppState.isAvailable) {\n invariant(EVENT_TYPES.indexOf(type) !== -1, 'Trying to remove listener for unknown event: \"%s\"', type);\n\n if (type === 'change') {\n var listenerIndex = findIndex(listeners, function (pair) {\n return pair[0] === handler;\n });\n invariant(listenerIndex !== -1, 'Trying to remove AppState listener for unregistered handler');\n var callback = listeners[listenerIndex][1];\n document.removeEventListener(VISIBILITY_CHANGE_EVENT, callback, false);\n listeners.splice(listenerIndex, 1);\n }\n }\n };\n\n _createClass(AppState, null, [{\n key: \"currentState\",\n get: function get() {\n if (!AppState.isAvailable) {\n return AppStates.ACTIVE;\n }\n\n switch (document[VISIBILITY_STATE_PROPERTY]) {\n case 'hidden':\n case 'prerender':\n case 'unloaded':\n return AppStates.BACKGROUND;\n\n default:\n return AppStates.ACTIVE;\n }\n }\n }]);\n\n return AppState;\n}();\n\nAppState.isAvailable = canUseDOM && document[VISIBILITY_STATE_PROPERTY];\nexport { AppState as default };"]},"metadata":{},"sourceType":"script"}