Skip to content

Instantly share code, notes, and snippets.

@antimatter15
Last active August 6, 2016 03:41
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 antimatter15/3569e904b29579896c89cd05bbeae704 to your computer and use it in GitHub Desktop.
Save antimatter15/3569e904b29579896c89cd05bbeae704 to your computer and use it in GitHub Desktop.
Merp
SUCH SPACE CAN YOU SEE THIS
doc.save()
import "babel-polyfill";
import React from 'react';
import ReactDOM from 'react-dom';
import { createStore } from 'redux'
// import { ReduxRoot, ReduceRoot } from './state/root.js'
var { ReduxRoot, ReduceRoot } = require('./state/root.js');
module.hot.accept('./state/root.js', function(){
ReduxRoot = require('./state/root.js').ReduxRoot
ReduceRoot = require('./state/root.js').ReduceRoot
})
// import App from './react/app.js';
var App = require('./react/app.js').default;
module.hot.accept('./react/app.js', function(){
App = require('./react/app.js').default;
store.dispatch({ type: '@@RELOAD' })
})
import INITIAL_DATA from './initial-data.js'
module.hot.accept('./initial-data.js', function(){ /* do nothing */ })
// module.hot.accept()
function reducer(state, action){
if(action.from === 'cursor'){
var redroot = new ReduceRoot(state)
var cursor = redroot.resolve(action.path);
if(!cursor) throw new Error('could not find cursor at path ' + action.path.join('/'));
var fn = cursor[action.meth]._action;
var new_cursor_data = fn.apply(cursor, action.args);
if(typeof new_cursor_data === 'undefined') throw new Error('action did not return new data');
return cursor.bubble(new_cursor_data)
}
return state
}
{"cells":[{"probes":[],"id":"scratch0","name":"cell0.js"},{"probes":[{"start":0,"end":10,"id":"&hj9py5"}],"id":"&1drc5i","name":"cell1.js"},{"probes":[],"id":"cell0","name":"cell2.js"}],"selections":[{"head":{"line":1,"ch":10},"anchor":{"line":1,"ch":10}}],"kernel_name":"Javascript","title":"Merp"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment