Security News
cURL Project and Go Security Teams Reject CVSS as Broken
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
delorean.js
Advanced tools
DeLorean is a tiny Flux pattern implementation.
You can install DeLorean with Bower:
bower install delorean
You can also install by NPM to use with Browserify (recommended)
npm install delorean.js
var Flux = require('delorean.js').Flux;
Stores contain the application state and logic. Their role is somewhat similar to a model in a traditional MVC, but they manage the state of many objects — they are not instances of one object. Nor are they the same as Backbone's collections. More than simply managing a collection of ORM-style objects, stores manage the application state for a particular domain within the application.
Flux.createStore
var TodoStore = Flux.createStore({
todos: [
{text: 'hello'},
{text: 'world'}
],
actions: {
'todo:add': 'addTodo',
'todo:remove': 'removeTodo'
},
addTodo: function (todo) {
this.todos.push({text: todo.text});
this.emit('change');
},
removeTodo: function (todoToComplete) {
this.todos = this.todos.filter(function (todo) {
return todoToComplete.text !== todo.text
});
this.emit('change');
},
getState: function () {
return {
todos: this.todos
}
}
});
Dispatchers are called Apps
in DeLorean. It manages all the logic of the
partial app.
The dispatcher is the central hub that manages all data flow in a Flux application. It is essentially a registry of callbacks into the stores. Each store registers itself and provides a callback. When the dispatcher responds to an action, all stores in the application are sent the data payload provided by the action via the callbacks in the registry.
Flux.createApp
var TodoListApp = Flux.createApp({
removeTodo: function (todo) {
if (confirm('Do you really want to delete this todo?')) {
this.dispatch('todo:remove', todo);
}
},
getStores: function () {
return {
todoStore: TodoStore
}
}
});
You may bring all the flow together with the Views, actually the Action generators.
You should use Flux.mixins.storeListener
mixin to get a view into the Flux system.
Also you should pass app={AppName}
attribute to React view.
// Child views don't have to have storeListener.
var TodoItemView = React.createClass({
render: function (todo) {
return <li onClick={this.handleClick}>{this.props.todo.text}</li>
},
handleClick: function () {
this.props.app.removeTodo(this.props.todo);
}
});
var TodoListView = React.createClass({
mixins: [Flux.mixins.storeListener],
render: function () {
var self = this;
return <ul>
{this.stores.todoStore.store.todos.map(function (todo) {
return <TodoItemView app={self.props.app} todo={todo}></TodoItemView>
})}
</ul>
}
});
grunt example
open example/index.html
The flux capacitor was the core component of Doctor Emmett Brown's time traveling DeLorean time machine
FAQs
Flux Library
The npm package delorean.js receives a total of 58 weekly downloads. As such, delorean.js popularity was classified as not popular.
We found that delorean.js 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
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.