File tree Expand file tree Collapse file tree 4 files changed +37
-1
lines changed Expand file tree Collapse file tree 4 files changed +37
-1
lines changed Original file line number Diff line number Diff line change 1+ import IconizeAPI from '@app/lib/api' ;
12import {
23 Editor ,
34 TAbstractFile ,
@@ -67,6 +68,14 @@ declare module 'obsidian' {
6768 }
6869
6970 interface App {
71+ plugins : {
72+ enabledPlugins : Set < string > ;
73+ plugins : {
74+ [ 'obsidian-icon-folder' ] ?: {
75+ api : IconizeAPI ;
76+ } ;
77+ } ;
78+ } ;
7079 internalPlugins : {
7180 plugins : InternalPlugins ;
7281 getPluginById < T extends keyof InternalPlugins > ( id : T ) : InternalPlugins [ T ] ;
Original file line number Diff line number Diff line change 1+ import IconizeAPI from './lib/api' ;
2+ import IconizePlugin from './main' ;
3+
4+ export function getApi ( plugin : IconizePlugin ) : IconizeAPI | undefined {
5+ return plugin . app . plugins . plugins [ 'obsidian-icon-folder' ] ?. api ;
6+ }
Original file line number Diff line number Diff line change 1+ import IconizePlugin from '@app/main' ;
2+
3+ export { AllIconsLoadedEvent } from '@lib/event/events' ;
4+
5+ export default interface IconizeAPI {
6+ version : {
7+ current : string ;
8+ } ;
9+ }
10+
11+ export function getApi ( plugin : IconizePlugin ) : IconizeAPI {
12+ return {
13+ version : {
14+ get current ( ) {
15+ return plugin . manifest . version ;
16+ } ,
17+ } ,
18+ } ;
19+ }
Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ import {
6262import ChangeColorModal from './ui/change-color-modal' ;
6363import { logger } from './lib/logger' ;
6464import { EventEmitter } from './lib/event/event' ;
65+ import { getApi } from './lib/api' ;
6566
6667export interface FolderIconObject {
6768 iconName : string | null ;
@@ -80,9 +81,10 @@ export default class IconizePlugin extends Plugin {
8081 public positionField : PositionField = buildPositionField ( this ) ;
8182
8283 private frontmatterCache = new Set < string > ( ) ;
83-
8484 private eventEmitter = new EventEmitter ( ) ;
8585
86+ public readonly api = getApi ( this ) ;
87+
8688 async onload ( ) {
8789 console . log ( `loading ${ config . PLUGIN_NAME } ` ) ;
8890
You can’t perform that action at this time.
0 commit comments