decord/source/lib/ZustandStore.tsx

71 lines
1.9 KiB
TypeScript
Raw Normal View History

2026-08-08 06:10:11 +00:00
// Module ID: 4170
// Function ID: 4171
2026-07-20 16:05:17 +00:00
// Name: defaultStatesAreEqual
2026-08-08 06:10:11 +00:00
// Dependencies: [700, 4171, 705, 2]
2026-07-20 16:05:17 +00:00
// Exports: createZustandStore
2026-08-08 06:10:11 +00:00
// Module 4170 (defaultStatesAreEqual)
2026-07-20 16:05:17 +00:00
function defaultStatesAreEqual(arg0, arg1) {
return arg0 === arg1;
}
2026-07-23 10:11:24 +00:00
const result = require("batchUpdates").fileFinishedImporting("lib/ZustandStore.tsx");
2026-07-20 16:05:17 +00:00
export const createZustandStore = function createZustandStore(arg0) {
2026-07-23 10:11:24 +00:00
const _require = arg0;
2026-07-29 08:29:29 +00:00
let obj = _require(700);
2026-08-08 06:10:11 +00:00
const dependencyMap = obj.createWithEqualityFn(_require(4171).subscribeWithSelector((arg0, arg1, arg2) => {
2026-07-23 10:11:24 +00:00
let callback = arg0;
return callback((arg0) => {
const callback = arg0;
2026-07-29 08:29:29 +00:00
return callback(outer1_1[2]).batchUpdates(() => callback(callback));
2026-07-23 10:11:24 +00:00
}, arg1, arg2);
}));
2026-07-20 16:05:17 +00:00
function setState(arg0) {
2026-07-23 10:11:24 +00:00
const callback = arg0;
2026-07-29 08:29:29 +00:00
callback(store[2]).batchUpdates(() => outer1_1.setState(initialState));
2026-07-20 16:05:17 +00:00
}
obj = {
2026-07-29 08:29:29 +00:00
useState(arg0) {
2026-07-20 16:05:17 +00:00
let tmp = arg1;
2026-07-29 08:29:29 +00:00
if (arg1 === undefined) {
tmp = setState;
}
return store(arg0, tmp);
},
getState(arg0) {
const state = store.getState();
let tmp2 = state;
if (null != arg0) {
tmp2 = arg0(state);
}
return tmp2;
},
useField(blocklist) {
2026-07-23 10:11:24 +00:00
let closure_0 = blocklist;
2026-07-29 08:29:29 +00:00
let tmp = arg1;
2026-07-20 16:05:17 +00:00
if (arg1 === undefined) {
tmp = setState;
}
2026-07-29 08:29:29 +00:00
if (tmp === undefined) {
tmp = setState;
}
return store((arg0) => arg0[closure_0], tmp);
2026-07-20 16:05:17 +00:00
},
getField(blocklist) {
2026-07-29 08:29:29 +00:00
return store.getState()[blocklist];
2026-07-20 16:05:17 +00:00
},
subscribe(arg0, arg1, arg2) {
return store.subscribe(arg0, arg1, arg2);
},
setState,
resetState() {
2026-07-29 08:29:29 +00:00
const initialState = store.getInitialState();
2026-08-04 21:03:28 +00:00
if (typeof setState !== "function") {
2026-07-29 08:29:29 +00:00
HermesBuiltin.throwTypeError();
}
callback(store[2]).batchUpdates(() => outer1_1.setState(initialState));
2026-07-20 16:05:17 +00:00
}
};
return obj;
};