
Security News
/Research
Popular node-ipc npm Package Infected with Credential Stealer
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.
Reevent is the flux-like store management. It manage the complex links in those stores and make the view respond to the store change easy.
Reevent contains the following objects:
Store: the state container that like MVC's model.
StoreApp: the store management container. It manage the life cycle of the stores and control the initialization sequence.
VMComponent or PureVMComponent: just like React Component or PureComponent but add some methods that can obseve the store's state change.
Reevent use the event-emitter style to notify other stores and components that the store state has changed.
npm install reevent --save
require the package by
const { StoreBase, VMComponent, PureVMComponent, ReeventProvider, ReeventApp } = require('reevent');
First, define some stores that your app need. Store object is the class extends StoreBase and contains the state.
The Store class contains constructor function that set the initialization state and some action methods that change the store's state by setState.
import { StoreBase } from 'reevent';
export default class TodoStore extends StoreBase {
constructor(key) {
super();
this.state = { key, todos: store(key) };
}
addTodo(title) {
let todos = this.state.todos.concat({
title: title,
completed: false
});
this.setState({ todos });
}
}
Then, create class AppStore that init the stores.
class AppStore extends ReeventApp {
loadInClient() {
this.todoStore = new TodoStore('reevent-todos');
return this;
}
loadInServer() {}
}
loadInClient will run the initialization method in browser and loadInServer will run the initialization function in server.
Then, create some React component just like before.
class TodoItem extends PureComponent {
constructor(props) {
super(props);
this.state = { editText: props.todo.title };
}
}
Then, create some VMComponent that observe the store's state change.
class TodoApp extends PureVMComponent {
constructor(props, context) {
super(props);
this.state = {
nowShowing: ALL_TODOS,
editing: null,
newTodo: ''
};
this.todoStore = context.reeventApp.todoStore;
}
componentWillMount() {
this.observeStore(this.todoStore);
}
}
The TodoApp will observe the todoStore state. When the todoStore state changes, the TodoApp's onStateChange method will be invoked and the TodoApp component's state will be changed.
import AppStore from './AppStore';
import { ReeventProvider } from 'reevent';
import TodoApp from './TodoApp';
const reeventApp = new AppStore().loadInClient();
ReactDOM.render(
<ReeventProvider reeventApp={reeventApp}>
<TodoApp />
</ReeventProvider>,
document.getElementsByClassName('todoapp')[0]
);
More info can refer to example/todoMVC/
FAQs
The flux framework for React
We found that reevent 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
/Research
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.

Security News
TeamPCP and BreachForums are promoting a Shai-Hulud supply chain attack contest with a $1,000 prize for the biggest package compromise.

Security News
Packagist urges PHP projects to update Composer after a GitHub token format change exposed some GitHub Actions tokens in CI logs.