Skip to content

Commit c0107f1

Browse files
committed
✨ Feature: add picgo.use for easily using plugin
1 parent 4342268 commit c0107f1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/core/PicGo.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import uploaders from '../plugins/uploader'
1010
import transformers from '../plugins/transformer'
1111
import PluginLoader from '../lib/PluginLoader'
1212
import { get, set, unset } from 'lodash'
13-
import { IHelper, IImgInfo, IConfig, IPicGo, IStringKeyMap, IPluginLoader, II18nManager } from '../types'
13+
import { IHelper, IImgInfo, IConfig, IPicGo, IStringKeyMap, IPluginLoader, II18nManager, IPicGoPlugin, IPicGoPluginInterface } from '../types'
1414
import getClipboardImage from '../utils/getClipboardImage'
1515
import Request from '../lib/Request'
1616
import DB from '../utils/db'
@@ -109,6 +109,11 @@ export class PicGo extends EventEmitter implements IPicGo {
109109
}
110110
}
111111

112+
use (plugin: IPicGoPlugin): IPicGoPluginInterface {
113+
const pluginInstance = plugin(this)
114+
return pluginInstance
115+
}
116+
112117
registerCommands (): void {
113118
if (this.configPath !== '') {
114119
this.cmd.init()

0 commit comments

Comments
 (0)