Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate Interaction API, to be replaced by Actions API #18

Merged
merged 4 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,7 @@ interface PluginInstance<T> {
): Unsubscriber;

/**
* @deprecated Use Action API instead
* Allows users to subscribe to changes in the passed in interaction ID
*/
subscribeToWorkbookInteraction(
Expand Down
2 changes: 1 addition & 1 deletion src/client/initialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export function initialize<T = {}>(): PluginInstance<T> {
},
fetchMoreElementData(id) {
void execPromise('wb:plugin:element:fetch-more', id);
}
},
},
destroy() {
Object.keys(listeners).forEach(event => delete listeners[event]);
Expand Down
1 change: 1 addition & 0 deletions src/react/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ export function useVariable(
}

/**
* @deprecated Use Action API instead
* React hook for accessing a workbook interaction selections state
* @param {string} id ID of variable within Plugin Config to use
* @returns {[(WorkbookSelection | undefined), Function]} Constantly updating selection state and setter thereof
Expand Down
3 changes: 3 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,14 @@ export interface PluginInstance<T = any> {
setVariable(id: string, ...values: unknown[]): void;

/**
* @deprecated Use Action API instead
* Getter for interaction selection state
* @param {string} id ID from interaction type in Plugin Config
*/
getInteraction(id: string): WorkbookSelection[];

/**
* @deprecated Use Action API instead
* Setter for interaction selection state
* @param {string} id ID from interaction type in Plugin Config
* @param {string} elementId Source element ID from element type in Plugin Config
Expand Down Expand Up @@ -297,6 +299,7 @@ export interface PluginInstance<T = any> {
): Unsubscriber;

/**
* @deprecated Use Action API instead
* Allows users to subscribe to changes in the passed in interaction ID
* @param {string} id ID of the interaction variable within Plugin Config
* @callback callback Function to be called upon receiving an updated interaction selection state
Expand Down