Skip to content

Commit

Permalink
fix: expose removeTabResources
Browse files Browse the repository at this point in the history
  • Loading branch information
valentine195 committed Jan 20, 2023
1 parent 5ffe31a commit 8eb6990
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,17 @@ interface Resource {
/**
* Add an arbitrary number of resources to the settings search.
* Returns a function that can be used to remove the registered resources.
*/
*/
SettingsSearch.addResources(...resources: Resource[]);

/**
* Remove an arbitrary number of resources from the settings search.
*/
SettingsSearch.removeResources(...resources: Resource[]);

/**
* Remove all resources associated with a particular SettingTab id.
*/
SettingsSearch.removeTabResources(id: string)

```
4 changes: 3 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ declare global {
SettingsSearch?: {
addResources: SettingsSearch["addResources"];
removeResources: SettingsSearch["removeResources"];
removeTabResources: SettingsSearch["removeTabResources"];
};
}
}
Expand Down Expand Up @@ -96,7 +97,8 @@ export default class SettingsSearch extends Plugin {
async onload() {
(window["SettingsSearch"] = {
addResources: this.addResources.bind(this),
removeResources: this.removeResources.bind(this)
removeResources: this.removeResources.bind(this),
removeTabResources: this.removeTabResources.bind(this)
}) && this.register(() => delete window["SettingsSearch"]);

this.app.workspace.onLayoutReady(async () => {
Expand Down

0 comments on commit 8eb6990

Please sign in to comment.