Open hjrdave opened 3 weeks ago
//Instantiate a Neuron Client const neuron = new NeuronClient({ name: "storeName" modules: [] }); neuron.listen((payload) => void); neuron.getSnapshot(); neuron.has(key); neuron.getRef(key); neuron.dispatch(key, (payload) => void); neuron.connect; //neuron instance, can be passed to other methods to help create extension libraries (maybe?) const count = neuron.init(initialValue, options); /* options: { key: string, onInit: (payload) => void, onRun: (payload) => void, onCallback: (payload) => void, actions: (dispatch) => ({[key: string]: () => void}), [key: string]: unknown //dynamic module properties } */ count.getClone();//gets a copy of non primitive values count.getRef();//gets a reference of non primitive values count.set(newValue); count.actions["actionName"] count.key count.dispatch((payload) => void) count.effect((payload) => void) //internals interface NeuronData{ state: unknown; actions: unknown; /// } const clientInventory = new map<NeuronData>();
Suggest API