- bla
- blabla
- bar
gem install blablabla
AppLink = React.createClass({ | |
render: function() { | |
return ( | |
<a href={this.props.href} onClick={this.onClick}> | |
{this.props.children} | |
</a> | |
); | |
}, | |
onClick: function(event) { | |
// don't reload page - dispatch a navigate Action, instead |
TaskStore = (function() { | |
var TaskStore = {}; | |
var state = {}; | |
TaskStore.addChangeListener = function() { | |
// left as an exercise - hint: event emitters | |
}; | |
TaskStore.addChangeListener = function() { |
(function() { | |
Dispather.register(function(action) { | |
if (action.type !== 'navigate') { | |
return; | |
} | |
window.history.pushState({}, '', action.path); | |
}); | |
})(); |
(function() { | |
Dispather.register(function(action) { | |
if (action.type !== 'navigate') { | |
return; | |
} | |
// sometimes we don't want to create history entries (see below) | |
if (action.pushState) { | |
window.history.pushState( | |
{path: action.path}, | |
'', |
AppLink = React.createClass({ | |
render: function() { | |
return ( | |
<a href={this.props.href} onClick={this.onClick}> | |
{this.props.children} | |
</a> | |
); | |
}, | |
onClick: function(event) { | |
event.preventDefault(); |
// example app initialization | |
$(function() { | |
Dispatcher.dispatch({ | |
type: 'initialize app', | |
path: window.location.pathname, | |
}); | |
}); |
// tired of this extension pattern | |
var Cow = AnimalFactory({ | |
getVoice: function() { return 'moo'; }), | |
numLegs: 4, | |
name: 'Cow', | |
}) | |
// propose this one instead | |
var MutantCow = AnimalFactory.extend() | |
.getVoice(function() { return 'moo'; }) |
const BookStore = function(deps) { | |
const self = Coherence(deps); | |
self.handleAction('search-book', searchBook); | |
return self.fluxSafe(); | |
function searchBook(payload) { | |
deps.books.fetch(payload.id).then(function(response) { | |
self.setData('book', response); | |
}) | |
} |
var appliedFilters = {}; | |
function anyFilterApplied() { | |
return Object.keys(appliedFilters).length > 0; | |
} | |
function applyFilter(filter, key) { | |
appliedFilters[key] = filter; | |
} |