Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

reflux

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reflux - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

bower.json

30

Gruntfile.js

@@ -8,5 +8,27 @@ module.exports = function(grunt) {

},
mochaTest: {
test: {
src: ['test/**/*.spec.js']
}
},
browserify: {
dist: {
src: ['src/index.js'],
dest: 'dist/<%= pkg.name %>.js',
options: {
bundleOptions: {
standalone: 'Reflux'
}
},
}
},
uglify: {
dist: {
src: 'dist/reflux.js',
dest: 'dist/reflux.min.js'
}
},
watch: {
files: ['<%= jshint.files %>'],
tasks: ['jshint']
tasks: ['build']
}

@@ -17,6 +39,8 @@ });

grunt.registerTask('test', ['jshint']);
grunt.registerTask('test', ['jshint', 'mochaTest']);
grunt.registerTask('default', ['jshint']);
grunt.registerTask('build', ['test', 'browserify', 'uglify']);
grunt.registerTask('default', ['watch']);
};
{
"name": "reflux",
"version": "0.0.2",
"version": "0.0.3",
"description": "A simple library for uni-directional dataflow application architecture inspired by ReactJS Flux",

@@ -15,2 +15,10 @@ "main": "src/index.js",

},
"browserify": {
"transform": [
"browserify-shim"
]
},
"browserify-shim": {
"lodash": "global:_"
},
"dependencies": {

@@ -20,7 +28,14 @@ "lodash": "~2.4.1"

"devDependencies": {
"browserify": "^4.2.0",
"browserify-shim": "^3.6.0",
"chai": "^1.9.1",
"grunt": "^0.4.5",
"grunt-browserify": "^2.1.2",
"grunt-contrib-jshint": "^0.10.0",
"grunt-contrib-uglify": "^0.5.0",
"grunt-contrib-watch": "^0.6.1",
"matchdep": "^0.3.0"
"grunt-mocha-test": "^0.11.0",
"matchdep": "^0.3.0",
"q": "^1.0.1"
}
}

78

README.md

@@ -5,3 +5,3 @@ # Reflux

# Installation
## Installation

@@ -12,61 +12,67 @@ You can currently install the package as a npm package:

# Usage
## Usage
Create an action by calling `createAction`.
var Reflux = require('reflux');
```javascript
var Reflux = require('reflux');
var statusUpdate = Reflux.createAction();
var statusUpdate = Reflux.createAction();
```
Create a data store by passing a definition object to `createStore`.
// Creates a DataStore
var statusStore = Reflux.createStore({
```javascript
// Creates a DataStore
var statusStore = Reflux.createStore({
// Initial setup
init: function() {
// Initial setup
init: function() {
// Register statusUpdate action
this.listenTo(statusUpdate, this.output);
},
// Register statusUpdate action
this.listenTo(statusUpdate, this.output);
},
// Callback
output: function(flag) {
var status = flag ? 'ONLINE' : 'OFFLINE';
this.trigger(status);
}
// Callback
output: function(flag) {
var status = flag ? 'ONLINE' : 'OFFLINE';
this.trigger(status);
}
});
});
```
In your component, register to listen to your data store like this:
// Fairly simple view component that outputs to console
function ConsoleComponent() {
```javascript
// Fairly simple view component that outputs to console
function ConsoleComponent() {
// Registers a console logging callback to the statusStore updates
statusStore.listen(function(status) {
console.log('status: ', status);
});
};
// Registers a console logging callback to the statusStore updates
statusStore.listen(function(status) {
console.log('status: ', status);
});
};
var consoleComponent = new ConsoleComponent();
var consoleComponent = new ConsoleComponent();
```
Invoke actions as if they were functions:
statusUpdate(true);
statusUpdate(false);
```javascript
statusUpdate(true);
statusUpdate(false);
/**
* Will output:
* status: ONLINE
* status: OFFLINE
*
*/
/**
* Will output:
* status: ONLINE
* status: OFFLINE
*/
```
See `test/index.js` for more example on how to use the package.
# License
## License
## [BSD 3-Clause License](http://opensource.org/licenses/BSD-3-Clause)
### [BSD 3-Clause License](http://opensource.org/licenses/BSD-3-Clause)

@@ -73,0 +79,0 @@ Copyright (c) 2014, Mikael Brassman

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc