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 displayName = 'reducer store'; | |
export const state = { count: 0 }; | |
export const reduce = (state, payload) => { | |
if (payload.action === 'increment') { | |
return { count: state.count + 1 }; | |
} else { | |
return state; | |
} |
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 Alt from 'alt' | |
import assign from 'object-assign' | |
const alt = new Alt() | |
class BaseStore { | |
constructor() { | |
this.state = { | |
a: 1 | |
} |
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 Alt from './' | |
const alt = new Alt() | |
const foo = alt.createActions({ | |
one() { | |
setTimeout(() => { | |
foo.two() | |
}) |
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
// include this file at the very beginning | |
import makeFinalStore from 'alt/utils/makeFinalStore' | |
// you'll also need to import your alt instance from wherever... | |
import alt from './somewhere/in/your/file/system/alt' | |
// this loads the app state from local storage and bootstraps it | |
const state = LocalStorage.getItem('my_app_state') | |
alt.bootstrap(state) |
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
'use strict' | |
const callThing = require('./transpiled-babel-code.js') | |
class OtherClass { } | |
callThing(OtherClass, 1, 2, 3) |
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 Alt from 'alt' | |
import axios from 'axios' | |
const alt = new Alt() | |
const actions = alt.generateActions('ok', 'fail') | |
const Source = { | |
a: { | |
remote() { |
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 Alt from 'alt' | |
const alt = new Alt() | |
function callback(f) { | |
setTimeout(f) | |
} | |
class Actions { | |
a() { |
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
function broken(x, ...foo) { | |
if (true) { | |
// this line creates an IIFE | |
class Foo extends Bar { | |
// constructors with rest throw things off | |
constructor(...other) { | |
super(...other) | |
} | |
} |
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 from 'react' | |
export function withData(fetch, MaybeComponent) { | |
function bind(Component) { | |
return React.createClass({ | |
contextTypes: { | |
universalId: React.PropTypes.string.isRequired, | |
buffer: React.PropTypes.object.isRequired | |
}, |
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
class Bar { } | |
function hello(one, two, three) { | |
console.log(1, one, 2, two, 3, three) | |
return one + two + three | |
} | |
function broken(x, ...foo) { | |
if (true) { | |
// this line creates an IIFE |