
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
corvid-storeon
Advanced tools
A tiny event-based state manager Storeon for Corvid by Wix.
You can use demo template to try corvid-storeon
public/store.js
import { createStore } from "corvid-storeon";
const counter = (store) => {
store.on("@init", () => ({ count: 0 }));
store.on("increment", ({ count }) => ({ count: count + 1 }));
};
export const { getState, dispatch, connect, connectPage } = createStore([counter]);
Page Code
import { dispatch, connect, connectPage } from "public/store.js";
// Subscribe for state property "count".
// The callback function will be run when the page loads ($w.onReady())
// and each time when property "count" would change.
connect("count", ({ count }) => {
$w("#text1").text = String(count);
});
// Wrapper around $w.onReady()
// The callback function will be run once.
connectPage((state) => {
$w("#button1").onClick(() => {
// Emit event
dispatch("increment");
});
});
The APIs for creating modules the same as Storeon Store
const { getState, dispatch, connect, connectPage } = createStore(modules);
createStore(Array<Module>): Store
will return current state.
const state = getState();
getState(): object
will emit an event with optional data.
dispatch("event/type", { value: 123 });
dispatch(event: string, [data: any]): void
connect to state by property key. Will return function disconnect from the store.
const disconnect = connect("key", (state) => { });
disconnect();
You can connect for multiple keys, the last argument must be a function.
connect("key1", "key2", (state) => { });
connect(key: string, [key: string, ...], handler: ConnectEventHandler): Disconnect
callback ConnectEventHandler(state: object): void
function Disconnect(): void
Sets the function that runs when all the page elements have finished loading. (wrapper around $w.onReady()
)
connectPage((state) => { });
connectPage(initFunction: ReadyHandler): void
callback ReadyHandler(state: object): void
You use the Package Manager to manage the npm packages in your site.
FAQs
This package has been deprecated
The npm package corvid-storeon receives a total of 2 weekly downloads. As such, corvid-storeon popularity was classified as not popular.
We found that corvid-storeon demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.