mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-07 00:07:07 +00:00
fix lint
This commit is contained in:
Vendored
+46
-48
@@ -4,54 +4,52 @@
|
||||
// AntonioMendez <https://github.com/AntonioMendez>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "redux-state-sync" {
|
||||
import { Store, Reducer, Middleware, AnyAction } from "redux";
|
||||
import BroadcastChannel from "broadcast-channel";
|
||||
import { Store, Reducer, Middleware, AnyAction } from "redux";
|
||||
import BroadcastChannel from "broadcast-channel";
|
||||
|
||||
export let lastUuid: number;
|
||||
export const GET_INIT_STATE: string;
|
||||
export const SEND_INIT_STATE: string;
|
||||
export const RECEIVE_INIT_STATE: string;
|
||||
export let lastUuid: number;
|
||||
export const GET_INIT_STATE: string;
|
||||
export const SEND_INIT_STATE: string;
|
||||
export const RECEIVE_INIT_STATE: string;
|
||||
|
||||
type Stamp = {
|
||||
$uuid: string;
|
||||
$wuid: string;
|
||||
};
|
||||
export type StampedAction = Stamp & AnyAction;
|
||||
|
||||
export interface Config {
|
||||
channel?: string;
|
||||
predicate?: Function | null;
|
||||
blacklist?: Array<string>;
|
||||
whitelist?: Array<string>;
|
||||
broadcastChannelOption?: object | null;
|
||||
}
|
||||
|
||||
export interface MessageListenerConfig {
|
||||
channel: BroadcastChannel;
|
||||
dispatch: (action: AnyAction | StampedAction) => void;
|
||||
allowed: (type?: string) => boolean;
|
||||
}
|
||||
|
||||
export const defaultConfig: Config;
|
||||
export const WINDOW_STATE_SYNC_ID: string;
|
||||
export let isMessageListenerCreated: boolean;
|
||||
|
||||
export function myMethod(a: string): string;
|
||||
export function myOtherMethod(a: number): number;
|
||||
|
||||
export function getIniteState(): AnyAction;
|
||||
export function sendIniteState(): AnyAction;
|
||||
export function receiveIniteState<S>(store: Store<S>): AnyAction;
|
||||
export function s4(): string;
|
||||
export function guid(): string;
|
||||
|
||||
export function generateUuidForAction(action: AnyAction): StampedAction;
|
||||
export function isActionAllowed(config: Config): (type?: any) => boolean;
|
||||
export function createMessageListener(config: MessageListenerConfig): void;
|
||||
export function createStateSyncMiddleware(config?: Config): Middleware;
|
||||
export function withReduxStateSync<S>(
|
||||
appReducer: Reducer<S>
|
||||
): (state: any, action: AnyAction) => Reducer<S>;
|
||||
export function initStateWithPrevTab<S>(store: Store<S>): Store<S>;
|
||||
export interface Stamp {
|
||||
$uuid: string;
|
||||
$wuid: string;
|
||||
}
|
||||
export type StampedAction = Stamp & AnyAction;
|
||||
|
||||
export interface Config {
|
||||
channel?: string;
|
||||
predicate?: (type?: string) => boolean | null;
|
||||
blacklist?: string[];
|
||||
whitelist?: string[];
|
||||
broadcastChannelOption?: object | null;
|
||||
}
|
||||
|
||||
export interface MessageListenerConfig {
|
||||
channel: BroadcastChannel;
|
||||
dispatch: (action: AnyAction | StampedAction) => void;
|
||||
allowed: (type?: string) => boolean;
|
||||
}
|
||||
|
||||
export const defaultConfig: Config;
|
||||
export const WINDOW_STATE_SYNC_ID: string;
|
||||
export let isMessageListenerCreated: boolean;
|
||||
|
||||
export function myMethod(a: string): string;
|
||||
export function myOtherMethod(a: number): number;
|
||||
|
||||
export function getIniteState(): AnyAction;
|
||||
export function sendIniteState(): AnyAction;
|
||||
export function receiveIniteState(store: Store): AnyAction;
|
||||
export function s4(): string;
|
||||
export function guid(): string;
|
||||
|
||||
export function generateUuidForAction(action: AnyAction): StampedAction;
|
||||
export function isActionAllowed(config: Config): (type?: any) => boolean;
|
||||
export function createMessageListener(config: MessageListenerConfig): void;
|
||||
export function createStateSyncMiddleware(config?: Config): Middleware;
|
||||
export function withReduxStateSync(
|
||||
appReducer: Reducer
|
||||
): (state: any, action: AnyAction) => Reducer;
|
||||
export function initStateWithPrevTab(store: Store): Store;
|
||||
|
||||
@@ -1,27 +1,24 @@
|
||||
import { createStore, applyMiddleware, Action } from 'redux'
|
||||
import { createStateSyncMiddleware, initStateWithPrevTab, withReduxStateSync } from 'redux-state-sync'
|
||||
|
||||
import { createStore, applyMiddleware, Action } from 'redux';
|
||||
import { createStateSyncMiddleware, initStateWithPrevTab, withReduxStateSync } from 'redux-state-sync';
|
||||
|
||||
interface TestState {
|
||||
a: number;
|
||||
b: string;
|
||||
c: string;
|
||||
}
|
||||
const config = {
|
||||
channel: 'test',
|
||||
predicate: () => {},
|
||||
blacklist: [],
|
||||
whitelist: [],
|
||||
broadcastChannelOption: {}
|
||||
}
|
||||
const middlewares = [
|
||||
createStateSyncMiddleware(config),
|
||||
createStateSyncMiddleware({
|
||||
channel: 'test',
|
||||
predicate: (type) => true,
|
||||
blacklist: [],
|
||||
whitelist: [],
|
||||
broadcastChannelOption: {}
|
||||
}),
|
||||
];
|
||||
|
||||
function rootReducer(state: TestState, action: Action): TestState {
|
||||
return state;
|
||||
}
|
||||
|
||||
const store = createStore(withReduxStateSync(rootReducer), ['test'], ...applyMiddleware(middlewares))
|
||||
initStateWithPrevTab(store);
|
||||
|
||||
const store = createStore(withReduxStateSync(rootReducer), ['test'], ...applyMiddleware(middlewares));
|
||||
initStateWithPrevTab(store);
|
||||
|
||||
Reference in New Issue
Block a user