download
raw
1.03 kB
'use strict';
const createStoreImpl = (createState) => {
let state;
const listeners = /* @__PURE__ */ new Set();
const setState = (partial, replace) => {
const nextState = typeof partial === "function" ? partial(state) : partial;
if (!Object.is(nextState, state)) {
const previousState = state;
state = (replace != null ? replace : typeof nextState !== "object" || nextState === null) ? nextState : Object.assign({}, state, nextState);
listeners.forEach((listener) => listener(state, previousState));
}
};
const getState = () => state;
const getInitialState = () => initialState;
const subscribe = (listener) => {
listeners.add(listener);
return () => listeners.delete(listener);
};
const api = { setState, getState, getInitialState, subscribe };
const initialState = state = createState(setState, getState, api);
return api;
};
const createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);
exports.createStore = createStore;

Xet Storage Details

Size:
1.03 kB
·
Xet hash:
ab165955a0175dead469f489cac714902b4929fe115d4c0d793c42706945d81e

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.