![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
flux-reducer
Advanced tools
The flux-like data flow for JavaScript apps.
It helps you write applications that behave consistently, run in different environments (client, server and native), have the good encapsulation and decouple with each other.
To install the flux-reducer
with npm
:
npm install --save flux-reducer
Now let's talk with the todo-list as a example.
First, we need create the Todo
reducer that can receive the message relative to 'Todo'.
import { Reducer } from 'flux-reducer';
class TodoReducer extends Reducer({
name: '',
detail: '',
isCompleted: false,
}) {
changeName(name) {
this.trigger(this.set('name', name));
}
};
The UI can send the 'changeName' to TodoReducer
to change the Todo
name. The trigger
will broadcast the new reducer to all subscribers.
Then, we need create Todos
reducer that can respond to Todo
collection related actions.
import { ArrayReducer } from 'flux-reducer';
class TodosReducer extends ArrayReducer {
constructor() {
super(...arguments);
this.monitorAllValues();
}
addTodo(todo) {
this.trigger(this.push(new TodoReducer(todo)));
}
}
We need invoke TodosReducer
's' addTodo
method to add the new Todo
instance.
Now, we can subscribe to TodosReducer
to get the new state.
let todosReducer = new TodosReducer;
todosReducer.subscribe((newReducer) => {
console.log('the todos have changed.');
});
todosReducer.addTodo({
name: 'new todo',
});
Invoke this code segment, the log information will show in the terminal.
FAQs
The flux-like data flow library.
The npm package flux-reducer receives a total of 0 weekly downloads. As such, flux-reducer popularity was classified as not popular.
We found that flux-reducer 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.