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 declare var red: { | |
50: string; | |
100: string; | |
200: string; | |
300: string; | |
400: string; | |
500: string; | |
600: string; | |
700: string; | |
800: 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
// tslint:disable:no-console | |
(function sw(self: ServiceWorkerGlobalScope) { | |
self.addEventListener('install', e => { | |
console.log('sw:install', e) | |
}) | |
self.addEventListener('activate', e => { | |
// e.waitUntil(self.clients.claim()) | |
console.log('sw:activate', e) | |
}) | |
self.addEventListener('message', e => { |
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 { Observable } from 'rxjs/Observable' | |
import { of } from 'rxjs/observable/of' | |
import { map } from 'rxjs/operators' | |
/** | |
* Typesafe rxjs/operators/plunk | |
* @example | |
* const state$ = of({ counter: { count: 0 } }) | |
* state$.pipe(getIn('counter', 'count')) //-> Observable<number> | |
*/ |
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 function combine<A, R1, R>(funcs: [Func1<A, R1>]): (value: A) => [R1] | |
export function combine<A, R1, R>(funcs: [Func1<A, R1>], project: (value: [R1]) => R): Func1<A, R> | |
export function combine<A, R1, R2, R>(funcs: [Func1<A, R1>, Func1<A, R2>]): Func1<A, [R1, R2]> | |
export function combine<A, R1, R2, R>(funcs: [Func1<A, R1>, Func1<A, R2>], project: (value: [R1, R2]) => R): Func1<A, R> | |
export function combine<A, R1, R2, R3, R>(funcs: [Func1<A, R1>, Func1<A, R2>, Func1<A, R3>]): Func1<A, [R1, R2, R3]> | |
export function combine<A, R1, R2, R3, R>(funcs: [Func1<A, R1>, Func1<A, R2>, Func1<A, R3>], project: (value: [R1, R2, R3]) => R): Func1<A, R> | |
export function combine<A, R1, R2, R3, R4, R>(funcs: [Func1<A, R1>, Func1<A, R2>, Func1<A, R3>, Func1<A, R4>]): Func1<A, [R1, R2, R3, R4]> | |
export function combine<A, R1, R2, R3, R4, R>( | |
funcs: [Func1<A, R1>, Func1<A, R2>, Func1<A, R3>, Func1<A, R4>], |
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 interface AnyAction { | |
type: any | |
} | |
export interface Action<P = any> extends AnyAction { | |
type: string | |
payload: P | |
[key: string]: any | |
} |
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 { Observable } from 'rxjs' | |
import { Dispatcher, select, createActionFactory } from './index' | |
import { bootFlux } from './boot-flux' | |
/* actions */ | |
interface Actions { | |
INCREMENT: number | |
DECREMENT: number | |
INCREMENT_ASYNC_REQUEST: any | |
INCREMENT_ASYNC_COMMIT: number |
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 { Observable, Subject, BehaviorSubject } from 'rxjs' | |
interface State { | |
counter: { count: number }, | |
user: { name: string, age: number } | |
} | |
const models = { | |
count(intent: { inc$: Observable<number>, dec$: Observable<number> }) { | |
type S = State['counter'] |
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
declare module 'idb-schema' { | |
export = Schema | |
class Schema { | |
readonly _current: { version: number, store: Schema.StoreDescription } | |
readonly _stores: { [key: string]: Schema.StoreDescription } | |
readonly _versions: Schema.VersionMap | |
stores(): Schema.StoreDescription[] | |
version(): number // current version |
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 { EventEmitter2 } from 'eventemitter2'; | |
import { Stream, fromEvent, mergeArray } from 'most'; | |
import { MiddlewareAPI, Middleware, Dispatch } from 'redux'; | |
// ================================================================== | |
// EventSource | |
// ================================================================== | |
export type Listener<T, K extends keyof T> = (arg: T[K]) => any; | |
export class TypedEventEmitter<T = any> extends EventEmitter2 { |
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
declare var navigator: Navigator; | |
// navigator.serviceWorker.readyはactivate直前に発火するため、controllerの存在確認には信用できない | |
// そのためcontrollerchangeイベントを待つ必要がある | |
export default function awaitServiceWorker() { | |
return new Promise<ServiceWorker>((resolve) => { | |
const resolved = () => resolve(navigator.serviceWorker.controller!); | |
if (navigator.serviceWorker.controller) { | |
resolved(); |
NewerOlder