obsidian#PluginManifest TypeScript Examples
The following examples show how to use
obsidian#PluginManifest.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: fnc-main.ts From folder-note-core with MIT License | 6 votes |
constructor(app: App, manifest: PluginManifest) {
super(app, manifest);
log.setDefaultLevel("ERROR");
const plugin = this;
this.api = getApi(plugin);
(window[API_NAME] = this.api) &&
this.register(() => delete window[API_NAME]);
this.trigger("folder-note:api-ready", this.api);
// patch create new note location for outside-same
this.register(
around(app.fileManager, {
// eslint-disable-next-line prefer-arrow/prefer-arrow-functions
getNewFileParent(next) {
// eslint-disable-next-line prefer-arrow/prefer-arrow-functions
return function (sourcePath) {
if (app.vault.getConfig("newFileLocation") === "current") {
const pref = plugin.settings.folderNotePref;
switch (pref) {
case NoteLoc.Index:
case NoteLoc.Inside:
break;
case NoteLoc.Outside: {
const folder = plugin.resolver.getFolderFromNote(sourcePath);
if (folder) return folder;
break;
}
default:
assertNever(pref);
}
}
return next.call(app.fileManager, sourcePath);
};
},
}),
);
}
Example #2
Source File: index.ts From obsidian-todoist-plugin with MIT License | 6 votes |
constructor(app: App, pluginManifest: PluginManifest) {
super(app, pluginManifest);
this.options = null;
this.api = null;
SettingsInstance.subscribe((value) => {
debug({
msg: "Settings changed",
context: value,
});
this.options = value;
});
this.queryInjector = new QueryInjector(app);
}
Example #3
Source File: index.ts From obsidian-switcher-plus with GNU General Public License v3.0 | 5 votes |
mockPlugin = jest.fn<Plugin, [app: App, manifest: PluginManifest]>(
(app, _manifest) => {
return mock<Plugin>({
app,
});
},
)