We'd like to unify our Router on both client and server and do away with the dispatcher.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var forEachPromise = function (array, callback) { | |
var i = 0; | |
function iterate() { | |
if (i < array.length) { | |
callback(arrray[i]).then(function () { | |
i++; | |
iterate(); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"styles": [ | |
{"type": "underline", "start": 12, "end": 19}, | |
{"type": "bold", "start": 27, "end": 31} | |
], | |
"annotations": [ | |
{"nodeId": 87, "start": 27, "end": 31} | |
], | |
"links": [], | |
"offsetX": 10, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var _ = require('underscore'); | |
var escape = require('escape-html'); | |
function recur(item) { | |
var ret; | |
if (_.isObject(item) || _.isArray(item)) { | |
ret = new item.constructor(); | |
_.each(item, function (val, key) { | |
ret[key] = recur(val); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var _ = require('underscore'); | |
var escape = require('escape-html'); | |
function ord(string) { | |
return string; | |
//return '' + string.charCodeAt(); | |
} | |
function pad(string, zeros) { | |
var count = zeros - string.length; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {Component} form 'react'; | |
import MyComponent from 'my-component.jsx'; // wrapped by FluxComponent | |
class ParentComponent extends Component { | |
componentDidMount() { | |
assert(this.fluxComponent.getWrapped() === this.childEl); | |
} | |
render() { | |
return <MyComponent ref={el => this.fluxComponent = el} wrappedRef={el => this.childEl = el} /> | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const key = generator => actionCreator => { | |
actionCreator.keyGenerator = generator; | |
return actionCreator; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@require_auth | |
@require_admin | |
def get(self): | |
args = self.get_parser().parse_args() | |
return User.get_by_id(args.id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const key = keyFunc => ( | |
wrappedFunc => { | |
wrappedFunc.KEY = keyFunc; | |
return wrappedFunc; | |
}; | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getUser = (userId) => (dispatch, getState) => { | |
// create a unique key for this request | |
const key = `@@getUser:${userId}`; | |
// if the action creator has already fired off a request, return it | |
const fetching = getState().fetching[key]; | |
if (fetching) { | |
return fetching; | |
} |
OlderNewer