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
import WS from 'ws'; | |
function setupDevtools() { | |
var messageListeners = []; | |
var closeListeners = []; | |
var ws = new WS('ws://localhost:8097/devtools'); | |
// this is accessed by the eval'd backend code | |
var FOR_BACKEND = { // eslint-disable-line no-unused-vars | |
wall: { | |
listen(fn) { |
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
/* @flow */ | |
type Auth = { | |
username: string; | |
password: string; | |
} | |
type Auth2 = { | |
username: 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
declare module 'redux-form' { | |
declare type Errors = Object; | |
declare type ValidationPromise = Promise<?Errors>; | |
declare type MapPropsToValues = (props:Object) => Object; | |
declare type ReduxFormProps = { | |
active: string; | |
asyncValidate: Function; | |
asyncValidating: boolean; |
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
// action-creator.js | |
type Auth = { | |
/** | |
* email address used as login | |
*/ | |
login: string; | |
/** | |
* password | |
*/ |
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
/** @flow */ | |
import type {Action} from '../redux'; | |
type Errors = Object; | |
type ValidationPromise = Promise<?Errors>; | |
type MapPropsToValues = (props:Object) => Object; | |
type ReduxFormProps = { |
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
import {QL, dispatch} from 'redux-ql'; | |
import {connect} from 'react-redux' | |
// before | |
connect(state => ({ | |
user: { | |
name: state.user.name, | |
id: state.user.id | |
}, |
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
// our apis return successfully from an HTTP/fetch promise standpoint for | |
// response payloads with error codes. We would like the reducer to receive this | |
// an rejection and not have to manage unwrapping that itself. | |
export default () => next => action => | |
action.type === 'FETCH' | |
? next(action).then(res => res.hasOwnProperty('error') ? Promise.reject(res) : res) | |
: next(action); |
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
/** @flow */ | |
import React, {Component, PropTypes} from 'react'; | |
import Popout from 'react-popout'; | |
import { | |
DevTools, | |
DebugPanel, | |
LogMonitor | |
} from 'redux-devtools/lib/react'; |
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
/* eslint-disable */ | |
import * as docgen from 'react-docgen'; | |
import {readFileSync as read} from 'fs'; | |
export default function ({Plugin, parse, types: t}) { | |
return new Plugin('styleguide-plugin', { | |
visitor: { | |
Program: { | |
enter (node, parent, scope, file) { | |
// console.log('Program file', file.opts.filename); |
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
/* @flow */ | |
// override Flow's setTimeout declaration for node | |
declare function setTimeout(callback: any, ms: number, ...args: Array<any>): {ref: Function; unref: Function}; | |
var timeout = setTimeout(function() {}, 100); | |
timeout.unref(); |