Socket
Book a DemoInstallSign in
Socket

consus-flux

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

consus-flux

Flux modules for the Consus project

0.3.0
latest
Source
npmnpm
Version published
Maintainers
2
Created
Source

consus-flux

Build Status codecov npm devDependency Status

Flux modules for the Consus project

Installing

npm install consus-flux --save

Using the Dispatcher

import { Dispatcher } from 'consus-flux';

Dispatcher.handleAction('INCREMENT', {
    amount: 5
});

Using the Store

import { Store } from 'consus-flux';

let count = 0;

class CounterStore extends Store {

    getCount() {
        return count;
    }

}

const store = new CounterStore();

store.registerHandler('INCREMENT', data => {
    count += data.amount;
    store.emitChange();
});

store.registerHandler('DECREMENT', data => {
    count -= data.amount;
    store.emitChange();
});

export default store;

Listening to a Store

import CounterStore from './counter-store';

function handleChange() {
    console.log('The count is now: ' + CounterStore.getCount());
}

CounterStore.addChangeListener(handleChange);

setTimeout(() {
    CounterStore.removeChangeListener(handleChange);
}, 10000);

Developing

Getting Started

# Clone the repository
git clone git@github.com:TheFourFifths/consus-flux.git
# Enter the project directory
cd consus-flux
# Install dependencies
npm install
# Build the project
npm run build
# Run the test suite
npm test

Development Scripts

  • npm test: Run the test suite
  • npm run lint: Run the linter
  • npm run build: Build the usable .dist directory
  • npm run coverage: Generate a code coverage report

Project File Structure

  • src: The project's source code
  • test: The project's tests
    • lib: Miscellaneous library modules
    • unit: Unit tests

Keywords

consus

FAQs

Package last updated on 12 Oct 2016

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.