Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Beautiful, light and simple state manager inspired by Redux
import Store, { Collection } from 'delux';
let store = new Store ();
store.tasks = new Collection ({tasks: []});
store.tasks.on('addTask', (tasks, action) => tasks.concat({
name: action.payload,
completed: false
}));
store.subscribe('tasks', (state) => console.log(state.tasks));
store.dispatch({
type: 'addTask',
payload: 'Try Delux'
});
The Store holds the whole application state and it's mutation logic.
let store = new Store();
Stores are objects whose prototype has methods to mutate there state. The Store's state is hold in Collections assigned to it.
Object with mutations of the collections' states.
Dispatches a Flux Standard Action on the state.
store.dispatch({
type: <string | symbol>,
payload: <object>
error: <boolean>,
meta: <any>
});
Returns
A promise which resolves to the the mutated store state.
Adds an subscriber for mutations in the store's collections
store.subscribe(['collectionName'], (state) => {
});
Parameters
Name | Supplied Value |
---|---|
state | Store.prototype.state alias |
Adds a middlware to the action resolution process
store.use(middleware|type|{type: middleware}, <middleware>);
Parameters
middlware - a function that mutates a given action. If it returns a Promise the store will wait for the promise to complete before passing it to the next middleware and the reducers.
type - action type to apply middleware on.
Adds a function to the store's execute queue
store.queue(() => callback());
Get specific collection's state from the store's state
let partialState = store.state.get(collectionNames);
Collections holds a sub-state (similar to Flux Stores) and it's mutation logic
store.collectionName = new Collection (init);
Parameters
Reflects the collections's state
Reflects the collections's reducers
Reflects the collections's subscribers
Attach a reducer to received actions (Node style)
store.collectionName.on(['actionType'], (state, action) => {
});
Parameters
Name | Supplied Value |
---|---|
state | The collection state |
action | The dispatched action |
FAQs
Beautiful, light and simple state manager inspired by Redux
The npm package delux receives a total of 0 weekly downloads. As such, delux popularity was classified as not popular.
We found that delux 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.