Skip to content

Commit

Permalink
✨ Feature: add picgo.use for easily using plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Molunerfinn committed Aug 27, 2022
1 parent 4342268 commit c0107f1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/core/PicGo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import uploaders from '../plugins/uploader'
import transformers from '../plugins/transformer'
import PluginLoader from '../lib/PluginLoader'
import { get, set, unset } from 'lodash'
import { IHelper, IImgInfo, IConfig, IPicGo, IStringKeyMap, IPluginLoader, II18nManager } from '../types'
import { IHelper, IImgInfo, IConfig, IPicGo, IStringKeyMap, IPluginLoader, II18nManager, IPicGoPlugin, IPicGoPluginInterface } from '../types'
import getClipboardImage from '../utils/getClipboardImage'
import Request from '../lib/Request'
import DB from '../utils/db'
Expand Down Expand Up @@ -109,6 +109,11 @@ export class PicGo extends EventEmitter implements IPicGo {
}
}

use (plugin: IPicGoPlugin): IPicGoPluginInterface {
const pluginInstance = plugin(this)
return pluginInstance
}

registerCommands (): void {
if (this.configPath !== '') {
this.cmd.init()
Expand Down

0 comments on commit c0107f1

Please sign in to comment.