decord/source/209_NativeEventEmitter.js

96 lines
2.8 KiB
JavaScript
Raw Normal View History

2026-07-20 16:05:17 +00:00
// Module ID: 209
2026-07-29 08:29:29 +00:00
// Function ID: 210
2026-07-20 16:05:17 +00:00
// Name: NativeEventEmitter
2026-07-29 08:29:29 +00:00
// Dependencies: [41, 42, 92, 38]
2026-07-20 16:05:17 +00:00
// Module 209 (NativeEventEmitter)
2026-07-23 10:11:24 +00:00
import _classCallCheck from "_classCallCheck";
2026-07-29 08:29:29 +00:00
import _createClass from "_createClass";
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
let NativeEventEmitter = importDefault;
class NativeEventEmitter {
constructor(arg0) {
tmp = outer1_2(this, NativeEventEmitter);
2026-08-04 21:03:28 +00:00
tmp2 = global && typeof global.addListener === "function";
tmp3 = global && typeof global.removeListeners === "function";
2026-07-29 08:29:29 +00:00
if (global) {
if (tmp2) {
2026-07-20 16:05:17 +00:00
if (tmp3) {
2026-07-29 08:29:29 +00:00
this._nativeModule = global;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
}
if (null != global) {
if (!tmp2) {
tmp4 = globalThis;
_console = console;
str = "`new NativeEventEmitter()` was called with a non-null argument without the required `addListener` method.";
warnResult = console.warn("`new NativeEventEmitter()` was called with a non-null argument without the required `addListener` method.");
}
if (!tmp3) {
tmp6 = globalThis;
_console2 = console;
str2 = "`new NativeEventEmitter()` was called with a non-null argument without the required `removeListeners` method.";
warnResult1 = console.warn("`new NativeEventEmitter()` was called with a non-null argument without the required `removeListeners` method.");
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
return;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
}
let items = [
{
2026-07-20 16:05:17 +00:00
key: "addListener",
value: function addListener(arg0, arg1, arg2) {
2026-07-23 10:11:24 +00:00
const self = this;
let _nativeModule = this._nativeModule;
2026-07-29 08:29:29 +00:00
if (_nativeModule != null) {
2026-07-20 16:05:17 +00:00
_nativeModule.addListener(arg0);
}
2026-07-29 08:29:29 +00:00
let obj = NativeEventEmitter(self[2]);
NativeEventEmitter = obj.addListener(arg0, arg1, arg2);
2026-07-20 16:05:17 +00:00
obj = {
remove() {
2026-07-29 08:29:29 +00:00
if (null != c0) {
2026-07-20 16:05:17 +00:00
const _nativeModule = self._nativeModule;
2026-07-29 08:29:29 +00:00
if (_nativeModule != null) {
2026-07-20 16:05:17 +00:00
_nativeModule.removeListeners(1);
}
2026-07-29 08:29:29 +00:00
c0.remove();
c0 = null;
2026-07-20 16:05:17 +00:00
}
}
};
return obj;
}
2026-07-29 08:29:29 +00:00
},
{
2026-07-20 16:05:17 +00:00
key: "emit",
value: function emit(arg0) {
2026-07-29 08:29:29 +00:00
const substr = [...arguments].slice();
const items = [arg0, ...substr];
NativeEventEmitter(92).emit.apply(items);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
},
{
2026-07-20 16:05:17 +00:00
key: "removeAllListeners",
value: function removeAllListeners(arg0) {
const self = this;
2026-07-29 08:29:29 +00:00
NativeEventEmitter(38)(null != arg0, "`NativeEventEmitter.removeAllListener()` requires a non-null argument.");
2026-07-20 16:05:17 +00:00
const _nativeModule = this._nativeModule;
2026-07-29 08:29:29 +00:00
if (_nativeModule != null) {
2026-07-20 16:05:17 +00:00
_nativeModule.removeListeners(self.listenerCount(arg0));
}
2026-07-29 08:29:29 +00:00
NativeEventEmitter(92).removeAllListeners(arg0);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
},
{
2026-07-20 16:05:17 +00:00
key: "listenerCount",
value: function listenerCount(arg0) {
2026-07-29 08:29:29 +00:00
return NativeEventEmitter(92).listenerCount(arg0);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
}
];
export default _createClass(NativeEventEmitter, items);