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
// Recipe for a pedantically correct subclass of JavaScript's built-in | |
// "Error" constructor. | |
// * Preserves the ability of JS Errors to be constructed with | |
// a `new`-less function call | |
// * Can be subclassed itself | |
// * Backward- and Forward-compatible TypeScript annotations | |
// * Correct enumerable / writable / configurable settings on | |
// .prototype, .prototype.constructor, .prototype.name, and | |
// custom instance fields. |
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
/* @flow */ | |
export function foo(test: boolean, callback: () => Array<number>): Array<number|string> { | |
if (test) return [1, '1']; | |
return callback(); | |
} | |
3: export function foo(test: boolean, callback: () => Array<number>): Array<number|string> { | |
^^^^^^ string. This type is incompatible with | |
3: export function foo(test: boolean, callback: () => Array<number>): Array<number|string> { |
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
$ flow check | |
src/injectCallbacks.js:0 | |
0: | |
^ inconsistent use of library definitions | |
67: detachEvent?: (type: string, listener: EventListener) => void; | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ undefined. This type is incompatible with. See: /private/tmp/flow/flowlib_2dc60f56/dom.js:67 | |
67: detachEvent?: (type: string, listener: EventListener) => void; | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function type. See: /private/tmp/flow/flowlib_2dc60f56/dom.js:67 |
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
/* @flow */ | |
declare class SVGElement extends Element {} | |
declare class HTMLParagraphElement extends HTMLElement { | |
align: string; | |
} | |
type ElementRegistrationOptions<T> = { | |
prototype?: { |
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
element.js: | |
------------------------------ | |
/* @flow */ | |
declare class HTMLParagraphElement extends HTMLElement { | |
align: string | |
} | |
type CustomElementCallbacks = { | |
createdCallback?: () => void; |
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
element.js | |
/* @flow */ | |
declare class HTMLParagraphElement extends HTMLElement { | |
align: string | |
} | |
declare class Document extends Node { | |
registerElement(type: string, options?: ElementRegistrationOptions): void; | |
} |
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 { default as React, Component, Children, cloneElement } from 'react'; | |
class ComponentWithComputedWidths extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { computedWidthsAvailable = false; computedWidths: {} }; | |
this.updateComputedWidths = this.updateComputedWidths.bind(this); | |
} | |
updateComputedWidths() { |
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
<!-- polyfills --> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/bluebird/2.9.34/bluebird.min.js"> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/fetch/0.9.0/fetch.min.js"> | |
<script> | |
var imageCache = {}; | |
function preload(name) { | |
var url = "images/" + name + ".jpg"; | |
return fetch(url) // returns a promise... |
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 default React.createClass({ | |
displayName: 'Oceans Navigation Category', | |
propTypes: { | |
list: React.PropTypes.arrayOf( | |
React.PropTypes.shape({ | |
humanReadableName: React.PropTypes.string, | |
url: React.PropTypes.string | |
}) |
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
// bootstrap React Router | |
import React from 'react'; | |
import { default as Router, Route, DefaultRoute, HistoryLocation, RouteHandler } from 'react-router'; | |
import { Splash } from '../components_angular/splash'; | |
import index from './index'; | |
let oceans; | |
if (!PRODUCTION) { | |
oceans = ( | |
<Route handler={require('./oceans/navigation')} path='oceans'> |
NewerOlder