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
11 KiB

{"ast":null,"code":"import _classCallCheck from \"@babel/runtime/helpers/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/createClass\";\nimport invariant from 'fbjs/lib/invariant';\nimport EmitterSubscription from \"./_EmitterSubscription\";\nimport EventSubscriptionVendor from \"./_EventSubscriptionVendor\";\nvar sparseFilterPredicate = function sparseFilterPredicate() {\n return true;\n};\nvar EventEmitter = function () {\n function EventEmitter(subscriber) {\n _classCallCheck(this, EventEmitter);\n this._subscriber = subscriber || new EventSubscriptionVendor();\n }\n _createClass(EventEmitter, [{\n key: \"addListener\",\n value: function addListener(eventType, listener, context) {\n return this._subscriber.addSubscription(eventType, new EmitterSubscription(this, this._subscriber, listener, context));\n }\n }, {\n key: \"removeAllListeners\",\n value: function removeAllListeners(eventType) {\n this._subscriber.removeAllSubscriptions(eventType);\n }\n }, {\n key: \"removeSubscription\",\n value: function removeSubscription(subscription) {\n invariant(subscription.emitter === this, 'Subscription does not belong to this emitter.');\n this._subscriber.removeSubscription(subscription);\n }\n }, {\n key: \"listenerCount\",\n value: function listenerCount(eventType) {\n var subscriptions = this._subscriber.getSubscriptionsForType(eventType);\n return subscriptions ? subscriptions.filter(sparseFilterPredicate).length : 0;\n }\n }, {\n key: \"emit\",\n value: function emit(eventType) {\n var subscriptions = this._subscriber.getSubscriptionsForType(eventType);\n if (subscriptions) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n for (var i = 0, l = subscriptions.length; i < l; i++) {\n var subscription = subscriptions[i];\n if (subscription && subscription.listener) {\n subscription.listener.apply(subscription.context, args);\n }\n }\n }\n }\n }, {\n key: \"removeListener\",\n value: function removeListener(eventType, listener) {\n console.error(\"EventEmitter.removeListener('\" + eventType + \"', ...): Method has been \" + 'deprecated. Please instead use `remove()` on the subscription ' + 'returned by `EventEmitter.addListener`.');\n var subscriptions = this._subscriber.getSubscriptionsForType(eventType);\n if (subscriptions) {\n for (var i = 0, l = subscriptions.length; i < l; i++) {\n var subscription = subscriptions[i];\n if (subscription && subscription.listener === listener) {\n subscription.remove();\n }\n }\n }\n }\n }]);\n return EventEmitter;\n}();\nexport default EventEmitter;","map":{"version":3,"names":["invariant","EmitterSubscription","EventSubscriptionVendor","sparseFilterPredicate","EventEmitter","subscriber","_subscriber","eventType","listener","context","addSubscription","removeAllSubscriptions","subscription","emitter","removeSubscription","subscriptions","getSubscriptionsForType","filter","length","_len","arguments","args","Array","_key","i","l","apply","console","error","remove"],"sources":["/Users/thomaschazot/Documents/But2A/LaSuperMeteo/iut-expo-starter/node_modules/react-native-web/dist/vendor/react-native/emitter/_EventEmitter.js"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and 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 * @format\n * \n * @typecheck\n */\nimport invariant from 'fbjs/lib/invariant';\nimport EmitterSubscription from './_EmitterSubscription';\nimport EventSubscriptionVendor from './_EventSubscriptionVendor';\n\nvar sparseFilterPredicate = () => true;\n\n/**\n * @class EventEmitter\n * @description\n * An EventEmitter is responsible for managing a set of listeners and publishing\n * events to them when it is told that such events happened. In addition to the\n * data for the given event it also sends a event control object which allows\n * the listeners/handlers to prevent the default behavior of the given event.\n *\n * The emitter is designed to be generic enough to support all the different\n * contexts in which one might want to emit events. It is a simple multicast\n * mechanism on top of which extra functionality can be composed. For example, a\n * more advanced emitter may use an EventHolder and EventFactory.\n */\nclass EventEmitter {\n /**\n * @constructor\n *\n * @param {EventSubscriptionVendor} subscriber - Optional subscriber instance\n * to use. If omitted, a new subscriber will be created for the emitter.\n */\n constructor(subscriber) {\n this._subscriber = subscriber || new EventSubscriptionVendor();\n }\n /**\n * Adds a listener to be invoked when events of the specified type are\n * emitted. An optional calling context may be provided. The data arguments\n * emitted will be passed to the listener function.\n *\n * TODO: Annotate the listener arg's type. This is tricky because listeners\n * can be invoked with varargs.\n *\n * @param {string} eventType - Name of the event to listen to\n * @param {function} listener - Function to invoke when the specified event is\n * emitted\n * @param {*} context - Optional context object to use when invoking the\n * listener\n */\n\n\n addListener(eventType, // FIXME: listeners should return void instead of mixed to prevent issues\n listener, context) {\n return this._subscriber.addSubscription(eventType, new EmitterSubscription(this, this._subscriber, listener, context));\n }\n /**\n * Removes all of the registered listeners, including those registered as\n * listener maps.\n *\n * @param {?string} eventType - Optional name of the event whose registered\n * listeners to remove\n */\n\n\n removeAllListeners(eventType) {\n this._subscriber.removeAllSubscriptions(eventType);\n }\n /**\n * @deprecated Use `remove` on the EventSubscription from `addListener`.\n */\n\n\n removeSubscription(subscription) {\n invariant(subscription.emitter === this, 'Subscription does not belong to this emitter.');\n\n this._subscriber.removeSubscription(subscription);\n }\n /**\n * Returns the number of listeners that are currently registered for the given\n * event.\n *\n * @param {string} eventType - Name of the event to query\n * @returns {number}\n */\n\n\n listenerCount(eventType) {\n var subscriptions = this._subscriber.getSubscriptionsForType(eventType);\n\n return subscriptions ? // We filter out missing entries because the array is sparse.\n // \"callbackfn is called only for elements of the array which actually\n // exist; it is not called for missing elements of the array.\"\n // https://www.ecma-international.org/ecma-262/9.0/index.html#sec-array.prototype.filter\n subscriptions.filter(sparseFilterPredicate).length : 0;\n }\n /**\n * Emits an event of the given type with the given data. All handlers of that\n * particular type will be notified.\n *\n * @param {string} eventType - Name of the event to emit\n * @param {...*} Arbitrary arguments to be passed to each registered listener\n *\n * @example\n * emitter.addListener('someEvent', function(message) {\n * console.log(message);\n * });\n *\n * emitter.emit('someEvent', 'abc'); // logs 'abc'\n */\n\n\n emit(eventType) {\n var subscriptions = this._subscriber.getSubscriptionsForType(eventType);\n\n if (subscriptions) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n for (var i = 0, l = subscriptions.length; i < l; i++) {\n var subscription = subscriptions[i]; // The subscription may have been removed during this event loop.\n\n if (subscription && subscription.listener) {\n subscription.listener.apply(subscription.context, args);\n }\n }\n }\n }\n /**\n * @deprecated Use `remove` on the EventSubscription from `addListener`.\n */\n\n\n removeListener(eventType, // FIXME: listeners should return void instead of mixed to prevent issues\n listener) {\n console.error(\"EventEmitter.removeListener('\" + eventType + \"', ...): Method has been \" + 'deprecated. Please instead use `remove()` on the subscription ' + 'returned by `EventEmitter.addListener`.');\n\n var subscriptions = this._subscriber.getSubscriptionsForType(eventType);\n\n if (subscriptions) {\n for (var i = 0, l = subscriptions.length; i < l; i++) {\n var subscription = subscriptions[i]; // The subscription may have been removed during this event loop.\n // its listener matches the listener in method parameters\n\n if (subscription && subscription.listener === listener) {\n subscription.remove();\n }\n }\n }\n }\n\n}\n\nexport default EventEmitter;"],"mappings":";;AAUA,OAAOA,SAAS,MAAM,oBAAoB;AAC1C,OAAOC,mBAAmB;AAC1B,OAAOC,uBAAuB;AAE9B,IAAIC,qBAAqB,GAAG,SAAxBA,qBAAqB;EAAA,OAAS,IAAI;AAAA;AAAC,IAejCC,YAAY;EAOhB,sBAAYC,UAAU,EAAE;IAAA;IACtB,IAAI,CAACC,WAAW,GAAGD,UAAU,IAAI,IAAIH,uBAAuB,EAAE;EAChE;EAAC;IAAA;IAAA,OAiBD,qBAAYK,SAAS,EACrBC,QAAQ,EAAEC,OAAO,EAAE;MACjB,OAAO,IAAI,CAACH,WAAW,CAACI,eAAe,CAACH,SAAS,EAAE,IAAIN,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAACK,WAAW,EAAEE,QAAQ,EAAEC,OAAO,CAAC,CAAC;IACxH;EAAC;IAAA;IAAA,OAUD,4BAAmBF,SAAS,EAAE;MAC5B,IAAI,CAACD,WAAW,CAACK,sBAAsB,CAACJ,SAAS,CAAC;IACpD;EAAC;IAAA;IAAA,OAMD,4BAAmBK,YAAY,EAAE;MAC/BZ,SAAS,CAACY,YAAY,CAACC,OAAO,KAAK,IA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