Skip to content

Instantly share code, notes, and snippets.

@voronianski
Last active December 18, 2016 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save voronianski/bb2ca658548c1a5d438924fd03273c37 to your computer and use it in GitHub Desktop.
Save voronianski/bb2ca658548c1a5d438924fd03273c37 to your computer and use it in GitHub Desktop.
esnextbin sketch
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>ESNextbin Sketch</title>
<!-- put additional styles and scripts here -->
</head>
<body>
<!-- put markup and other contents here -->
</body>
</html>
// write ES2015 code and import modules from npm
// and then press "Execute" to run your program
console.log('a');
import createStoreEmitter from 'store-emitter';
const initialState = {
count: 1
};
function modifier (action, state) {
if (action.type === 'increment') {
state.count = state.count+1;
}
}
const store = createStoreEmitter(modifier, initialState);
store.on('increment', (action, state, oldState) => {
console.log(action, state, oldState)
});
store({type: 'increment'});
{
"name": "esnextbin-sketch",
"version": "0.0.0",
"dependencies": {
"store-emitter": "2.2.0"
}
}
'use strict';
var _storeEmitter = require('store-emitter');
var _storeEmitter2 = _interopRequireDefault(_storeEmitter);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// write ES2015 code and import modules from npm
// and then press "Execute" to run your program
console.log('a');
var initialState = {
count: 1
};
function modifier(action, state) {
if (action.type === 'increment') {
state.count = state.count + 1;
}
}
var store = (0, _storeEmitter2.default)(modifier, initialState);
store.on('increment', function (action, state, oldState) {
console.log(action, state, oldState);
});
store({ type: 'increment' });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment