diff --git a/ActionStrategy.md b/ActionStrategy.md index 1fdbe2c..7b5577e 100644 --- a/ActionStrategy.md +++ b/ActionStrategy.md @@ -118,3 +118,35 @@ The same is true when accessing the payload from a reducer, method, or principle SomethingFactory> ``` This was a purposeful design choice, if you find yourself doing such. Known this system is already complicated enough. + +## Helper Functions for Standard Method Creators +*Note you still need to create a function of MethodCreator to use these Helpers* +```typescript +export const createMethod = + (method: (action: Action) => Action): [Method, Subject] => {} +export const createMethodWithConcepts = + (method: (action: Action) => Action, concepts$: UnifiedSubject): [Method, Subject] => {} +export const createAsyncMethod = + (asyncMethod: (controller: ActionController, action: Action) => void): [Method, Subject] => {} +export const createAsyncMethodWithConcepts = + (asyncMethodWithConcepts: (controller: ActionController, action: Action, concepts: Concept[]) => void, concepts$: UnifiedSubject) + : [Method, Subject] => {} +export const createMethodDebounce = + (method: (action: Action) => Action, duration: number): [Method, Subject] => {} +export const createMethodDebounceWithConcepts = + (methodWithConcepts: (action: Action, concepts: Concept[]) => Action, concepts$: UnifiedSubject, duration: number) + : [Method, Subject] => {} +export const createAsyncMethodDebounce = + (asyncMethod: (controller: ActionController, action: Action) => void, duration: number): [Method, Subject] => {} +export const createAsyncMethodDebounceWithConcepts = + (asyncMethodWithConcepts: (controller: ActionController, action: Action, concepts: Concept[]) => + void, concepts$: UnifiedSubject, duration: number): [Method, Subject] => {} +``` +* createMethod - Your standard method, be sure to handle the action.strategy via one of the strategy decision functions, in addition to passing the action if there is no attached strategy. +* createMethodWithConcepts - This will allow your method to have the most recent concepts to be accessed via the asyncMethod function. +* createAsyncMethod - Handled differently than the rest, you will have to use the passed controller to fire your actions back into the action stream. +* createAsyncMethodWithConcepts - Will also have access to the most recent concepts. +* createMethodDebounce - After the first action, this will filter actions within the duration to be set to the conclude action. +* createMethodDebounceWithConcepts - Will filter actions within the duration while providing access to the most recent concepts. +* createAsyncMethodDebounce - Will not disengage the initial ActionController, but will allow debounced actions to pass through when filtered as conclude actions. And will fire the first action upon its own conditions are met asynchronously. +* createAsyncMethodDebounceWithConcepts - Filters and then first the first action once conditions are met, and provides access to the most recent concepts. \ No newline at end of file diff --git a/package.json b/package.json index ec8101f..da09323 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@phuire/strx", - "version": "0.0.37", + "version": "0.0.38", "description": "Unified Turing Machine", "main": "dist/index.js", "module": "dist/index.mjs",