mirror of
https://github.com/captbaritone/webamp.git
synced 2026-08-01 14:33:38 +00:00
Add more redux types
This commit is contained in:
parent
f3c5b04286
commit
5bcb97c14f
2 changed files with 23 additions and 3 deletions
13
js/store.ts
13
js/store.ts
|
|
@ -7,7 +7,14 @@ import { merge } from "./utils";
|
|||
import { UPDATE_TIME_ELAPSED, STEP_MARQUEE } from "./actionTypes";
|
||||
import Media from "./media";
|
||||
import Emitter from "./emitter";
|
||||
import { Extras, MiddlewareStore, Dispatch, Action, AppState } from "./types";
|
||||
import {
|
||||
Extras,
|
||||
MiddlewareStore,
|
||||
Dispatch,
|
||||
Action,
|
||||
AppState,
|
||||
Middleware
|
||||
} from "./types";
|
||||
|
||||
const compose = composeWithDevTools({
|
||||
actionsBlacklist: [UPDATE_TIME_ELAPSED, STEP_MARQUEE]
|
||||
|
|
@ -16,8 +23,8 @@ const compose = composeWithDevTools({
|
|||
export default function(
|
||||
media: Media,
|
||||
actionEmitter: Emitter,
|
||||
customMiddlewares = [],
|
||||
stateOverrides: DeepPartial<AppState>,
|
||||
customMiddlewares: Middleware[] = [],
|
||||
stateOverrides: DeepPartial<AppState> | undefined,
|
||||
extras: Extras
|
||||
) {
|
||||
let initialState;
|
||||
|
|
|
|||
13
js/types.ts
13
js/types.ts
|
|
@ -474,6 +474,19 @@ export interface DispatchObject {
|
|||
|
||||
export type Dispatch = (action: Dispatchable) => void;
|
||||
|
||||
export type Reducer = (state: AppState, action: Action) => AppState;
|
||||
|
||||
export type Middleware = (
|
||||
store: Store
|
||||
) => (next: Dispatch) => (action: Action) => any;
|
||||
|
||||
export interface Store {
|
||||
subscribe(cb: () => void): () => void;
|
||||
dispatch: Dispatch;
|
||||
getState: GetState;
|
||||
replaceReducer(reducer: Reducer): void;
|
||||
}
|
||||
|
||||
export interface MiddlewareStore {
|
||||
dispatch: Dispatch;
|
||||
getState: GetState;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue