This file contains hidden or 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
// Usage example: | |
// | |
// willTransitionTo(transition, params, query, callback) { | |
// observeStore(DraftStore, s => s.isLoaded()).then(() => { | |
// if (DraftStore.isMissingTitle()) { | |
// transition.redirect('composeDraft', params); | |
// } | |
// }).finally(callback); | |
// } |
This file contains hidden or 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
/** @jsx React.DOM */ | |
'use strict'; | |
var React = require('react'), | |
{ PropTypes } = React; | |
var AudioPlayer = React.createClass({ | |
propTypes: { | |
source: PropTypes.string.isRequired, | |
isPlaying: PropTypes.bool.isRequired, |
This file contains hidden or 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
configureDragDrop(registerType) { | |
var imageThreshold = Math.max(120, window.innerHeight / 4), | |
sectionThreshold = Math.max(140, window.innerHeight / 4), | |
currentDY = 0, | |
frame; | |
function makeScrollingHandler(threshold) { | |
function getScrollDY(clientY) { | |
var speed; | |
if (clientY < threshold) { |
This file contains hidden or 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
function makeIdentitySourceMap(map, source, resourcePath) { | |
source.split('\n').map(function (line, index) { | |
map.addMapping({ | |
source: resourcePath, | |
original: { | |
line: index + 1, | |
column: 0 | |
}, | |
generated: { | |
line: index + 1, |
This file contains hidden or 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
// This is declarative document.title for React. | |
// No more updating document.title in lifecycle hooks and promise handlers! | |
// | |
// Usage: | |
// | |
// var SomePage = React.createClass({ | |
// render() { | |
// // Title might depend on state but it's fine with DocumentTitle | |
// return ( | |
// <DocumentTitle title={this.state.someData && this.state.someData.text}> |
This file contains hidden or 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
'use strict'; | |
var React = require('react'); | |
function createAsyncHandler(getHandlerAsync, displayName) { | |
var Handler = null; | |
return React.createClass({ | |
displayName: displayName, |
This file contains hidden or 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
/** @jsx React.DOM */ | |
'use strict'; | |
var React = require('react'), | |
escapeTextForBrowser = require('react/lib/escapeTextForBrowser'), | |
{ PropTypes } = React; | |
var UncontrolledContentEditable = React.createClass({ | |
propTypes: { | |
component: PropTypes.func, |
This file contains hidden or 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
'use strict'; | |
var React = require('react'), | |
classSet = require('react/lib/cx'), | |
_ = require('underscore'); | |
var ClassNameMixin = { | |
propTypes: { | |
className: React.PropTypes.string, | |
context: React.PropTypes.string |
This file contains hidden or 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 Article = React.createClass({ | |
mixins: [createStoreMixin(UserStore)], | |
propTypes: { | |
article: PropTypes.object.isRequired | |
}, | |
getStateFromStores() { | |
return { | |
author: UserStore.get(this.props.article.authorId); |
This file contains hidden or 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 Article = React.createClass({ | |
mixins: [createStoreMixin(ArticleStore)], | |
propTypes: { | |
articleId: PropTypes.number.isRequired | |
}, | |
getStateFromStores() { | |
return { | |
article: ArticleStore.get(this.props.articleId); |