Преглед изворни кода

improve the use function

tags/2.16.0
Caven Chen пре 3 година
родитељ
комит
5fdcc4b563
1 измењених фајлова са 4 додато и 1 уклоњено
  1. 4
    1
      modules/global-api/use.js

+ 4
- 1
modules/global-api/use.js Прегледај датотеку

@@ -9,7 +9,7 @@
* @returns this
*/
export function initUse(DC) {
DC.use = function(plugin) {
DC.use = function(plugin, lib) {
const installedPlugins =
this._installedPlugins || (this._installedPlugins = {})
if (this._installedPlugins[plugin.name]) {
@@ -17,6 +17,9 @@ export function initUse(DC) {
}
// additional parameters
const args = []
if (lib) {
args.push(lib)
}
args.unshift(this)
if (typeof plugin.install === 'function') {
plugin.install.apply(plugin, args)

Loading…
Откажи
Сачувај