66 lines
1.9 KiB
TypeScript
66 lines
1.9 KiB
TypeScript
// Metro module 6168 (f6169).
|
|
import * as _Module17 from "react-native";
|
|
import { $callWithNewTarget } from "../../../_hermes/prelude";
|
|
function $mk77953($env) {
|
|
return (data) => {
|
|
$env[0].handlers.forEach((handler) => handler({
|
|
data
|
|
}));
|
|
};
|
|
}
|
|
let c3909_0;
|
|
let env3909;
|
|
const { NativeModules, NativeEventEmitter } = _Module17;
|
|
const UserSearchWorkerManager = NativeModules.UserSearchWorkerManager;
|
|
class UserSearchWorker extends NativeEventEmitter {
|
|
constructor() {
|
|
let env15556;
|
|
super(UserSearchWorkerManager);
|
|
const r11 = env15556 = {};
|
|
env15556[0] = this;
|
|
this.handlers = new Set();
|
|
this.subscription = null;
|
|
this.handleCallback = $mk77953(r11);
|
|
}
|
|
postMessage(a0) {
|
|
if (a0) {
|
|
UserSearchWorkerManager.onmessage(JSON.stringify(a0));
|
|
return void 0;
|
|
}
|
|
throw new Error("Invalid data");
|
|
}
|
|
addEventListener(a0, a1) {
|
|
if (a0 === "message") {
|
|
if (this.subscription == null) {
|
|
this.subscription = this.addListener("ReturnResults", this.handleCallback);
|
|
}
|
|
this.handlers.add(a1);
|
|
}
|
|
}
|
|
removeEventListener(a0, a1) {
|
|
if (a0 === "message") {
|
|
this.handlers.delete(a1);
|
|
if (this.handlers.size === 0) {
|
|
const subscription = this.subscription;
|
|
if (subscription != null) {
|
|
subscription.remove();
|
|
}
|
|
this.subscription = null;
|
|
}
|
|
}
|
|
}
|
|
terminate() {
|
|
UserSearchWorkerManager.terminate();
|
|
}
|
|
}
|
|
const prototypeOf = Object.getPrototypeOf(UserSearchWorker);
|
|
const r24 = Object.create(UserSearchWorker.prototype);
|
|
const r25 = $callWithNewTarget(prototypeOf, r24, UserSearchWorker, UserSearchWorkerManager);
|
|
const exports2 = r25 instanceof Object ? r25 : r24;
|
|
const r28 = env3909 = {};
|
|
c3909_0 = exports2;
|
|
exports2.handlers = new Set();
|
|
exports2.subscription = null;
|
|
exports2.handleCallback = $mk77953(r28);
|
|
module.exports = exports2;
|