-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(redux): rewrite package to use decorators (#4)
- Loading branch information
Showing
7 changed files
with
122 additions
and
147 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,12 @@ | ||
import createContext from "@corpuscule/context"; | ||
import {CustomElementClass, UncertainCustomElementClass} from "@corpuscule/typings"; | ||
import {FieldDecorator} from "@corpuscule/typings"; | ||
|
||
export type DispatcherMap = ReadonlyArray<PropertyKey>; | ||
export type PropertyGetter<S> = (state: S) => any; | ||
|
||
export type ConnectedMap<S> = { | ||
readonly [P in PropertyKey]: PropertyGetter<S>; | ||
}; | ||
export const connected: <S>(getter: PropertyGetter<S>) => FieldDecorator; | ||
export const dispatcher: FieldDecorator; | ||
|
||
export interface ReduxClass<T, S> extends CustomElementClass<T> { | ||
readonly [dispatcherMap]?: DispatcherMap; | ||
readonly [connectedMap]?: ConnectedMap<S>; | ||
} | ||
|
||
export const connect: | ||
<S, T = {}>(target: UncertainCustomElementClass<T>) => ReduxClass<T, S>; | ||
export const connect: ClassDecorator; | ||
|
||
export const provider: ReturnType<typeof createContext>["provider"]; | ||
export const store: unique symbol; | ||
|
||
export const dispatcherMap: unique symbol; | ||
export const connectedMap: unique symbol; |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
export const context = Symbol("context"); | ||
export const initDispatchers = Symbol("initDispatchers"); | ||
export const registry = Symbol("registry"); | ||
export const subscribe = Symbol("subscribe"); | ||
export const unsubscribe = Symbol("unsubscribe"); | ||
export const update = Symbol("update"); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.