GT2/Ejectable/node_modules/@unimodules/react-native-adapter/build/EventEmitter.js.map

1 line
4.9 KiB
Plaintext
Raw Normal View History

2021-08-16 00:14:59 +00:00
{"version":3,"file":"EventEmitter.js","sourceRoot":"","sources":["../src/EventEmitter.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE5D,MAAM,4BAA4B,GAAG,+BAA+B,CAAC;AAiBrE,MAAM,OAAO,YAAY;IAKvB,YAAY,YAA0B;QAJtC,mBAAc,GAAG,CAAC,CAAC;QAKjB,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAClC,IAAI,CAAC,aAAa,GAAG,IAAI,kBAAkB,CAAC,YAAmB,CAAC,CAAC;IACnE,CAAC;IAED,WAAW,CAAI,SAAiB,EAAE,QAA4B;QAC5D,IAAI,CAAC,IAAI,CAAC,cAAc,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,IAAI,CAAC,aAAa,CAAC,cAAc,EAAE;YACtF,IAAI,CAAC,aAAa,CAAC,cAAc,EAAE,CAAC;SACrC;QAED,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,MAAM,yBAAyB,GAAG,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QACtF,MAAM,YAAY,GAAG;YACnB,CAAC,4BAA4B,CAAC,EAAE,yBAAyB;YACzD,MAAM,EAAE,GAAG,EAAE;gBACX,IAAI,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC;YACxC,CAAC;SACF,CAAC;QACF,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,kBAAkB,CAAC,SAAiB;QAClC,iFAAiF;QACjF,MAAM,oBAAoB,GAAG,IAAI,CAAC,aAAa,CAAC,aAAa;YAC3D,CAAC,CAAC,2CAA2C;gBAC3C,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,SA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react-native';\n\nconst nativeEmitterSubscriptionKey = '@@nativeEmitterSubscription@@';\n\ntype NativeModule = {\n startObserving?: () => void;\n stopObserving?: () => void;\n addListener: (eventName: string) => void;\n removeListeners: (count: number) => void;\n};\n\n// @needsAudit\nexport type Subscription = {\n /**\n * A method to unsubscribe the listener.\n */\n remove: () => void;\n};\n\nexport class EventEmitter {\n _listenerCount = 0;\n _nativeModule: NativeModule;\n _eventEmitter: NativeEventEmitter;\n\n constructor(nativeModule: NativeModule) {\n this._nativeModule = nativeModule;\n this._eventEmitter = new NativeEventEmitter(nativeModule as any);\n }\n\n addListener<T>(eventName: string, listener: (event: T) => void): Subscription {\n if (!this._listenerCount && Platform.OS !== 'ios' && this._nativeModule.startObserving) {\n this._nativeModule.startObserving();\n }\n\n this._listenerCount++;\n const nativeEmitterSubscription = this._eventEmitter.addListener(eventName, listener);\n const subscription = {\n [nativeEmitterSubscriptionKey]: nativeEmitterSubscription,\n remove: () => {\n this.removeSubscription(subscription);\n },\n };\n return subscription;\n }\n\n removeAllListeners(eventName: string): void {\n // @ts-ignore: the EventEmitter interface has been changed in react-native@0.64.0\n const removedListenerCount = this._eventEmitter.listenerCount\n ? // @ts-ignore: this is available since 0.64\n this._eventEmitter.listenerCount(eventName)\n : // @ts-ignore: this is available in older versions\n this._eventEmitter.listeners(eventName).length;\n this._eventEmitter.removeAllListeners(eventName);\n this._listenerCount -= removedListenerCount;\n invariant(\n this._listenerCount >= 0,\n `EventEmitter must have a non-negative number of listeners`\n );\n\n if (!this._listenerCount && Platform.OS !== 'ios' && this._n