New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

fluxium

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fluxium

A moderately reactive Flux implementation wrapped around Nuclear JS.

latest
Source
npmnpm
Version
0.0.11
Version published
Weekly downloads
5
-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

Fluxium

Summary

A small wrapper around Nuclear JS, Fluxium allows you to write your actions and stores as plain JS objects. The action creators of Flux, which traditionally dispatch actions via a central dispatch method, are replaced with intents which return observable streams of actions which Fluxium takes care of dispatching.

Example

Here is a deliberately simplistic example, showing how to use Fluxium.

var fluxium = require('fluxium');
var React = require('react');
var Observable = require('rx').Observable;
var Immutable = fluxium.Immutable;

var flux = fluxium.create({
	intents: {
		showAlert: function(message) {
			return Observable.just({
				type: 'SHOW_ALERT',
				payload: { message: message }
			})
		},
		dismissAlert: function () {
			return Observable.just({
				type: 'DISMISS_ALERT'
			})
		}
	},
	stores: {
		alert: {
			initialState: Immutable.Map({
				message: undefined
			}),
			handlers: {
				SHOW_ALERT: function (state, payload) {
					return state.set('message', payload.message)
				},
				DISMISS_ALERT: function (state) {
					return state.set('message', undefined)
				}
			}
		}
	},
	handleError: function (error) {
		console.error(JSON.stringify(error))
	}
});

var getters = {
	message: ['alert', 'message']
};

var Alert = React.createClass({
	mixins: [flux.mixin],
	getDataBindings: function () {
		message: getters.message
	},
	render: function () {
		var message = this.state.message

		if (message) {
			<div>
				<p>{this.state.message}</p>
				<button onClick={dismissAlert}>x</button>
			</div>
		}
		else {
			<div>No message</div>
		}
	},
	dismissAlert: function () {
		flux.intents.dismissAlert()
	}
})

Keywords

flux

FAQs

Package last updated on 17 Aug 2015

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