File tree 2 files changed +6
-0
lines changed
packages/@vue/cli-ui/src/graphql-api
2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ class PluginApi {
25
25
this . clientAddons = [ ]
26
26
this . views = [ ]
27
27
this . actions = new Map ( )
28
+ this . ipcHandlers = [ ]
28
29
}
29
30
30
31
/**
@@ -194,6 +195,7 @@ class PluginApi {
194
195
* @param {function } cb Callback with 'data' param
195
196
*/
196
197
ipcOn ( cb ) {
198
+ this . ipcHandlers . push ( cb )
197
199
return ipc . on ( cb )
198
200
}
199
201
@@ -203,6 +205,8 @@ class PluginApi {
203
205
* @param {any } cb Callback to be removed
204
206
*/
205
207
ipcOff ( cb ) {
208
+ const index = this . ipcHandlers . indexOf ( cb )
209
+ if ( index !== - 1 ) this . ipcHandlers . splice ( index , 1 )
206
210
ipc . off ( cb )
207
211
}
208
212
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ const PluginApi = require('../api/PluginApi')
32
32
// Utils
33
33
const { getCommand } = require ( '../utils/command' )
34
34
const { getBasePath } = require ( '../utils/serve' )
35
+ const ipc = require ( '../utils/ipc' )
35
36
36
37
const PROGRESS_ID = 'plugin-installation'
37
38
@@ -83,6 +84,7 @@ function resetPluginApi (context) {
83
84
// Clean up
84
85
if ( pluginApi ) {
85
86
pluginApi . views . forEach ( r => views . remove ( r . id , context ) )
87
+ pluginApi . ipcHandlers . forEach ( fn => ipc . off ( fn ) )
86
88
}
87
89
88
90
pluginApi = new PluginApi ( context )
You can’t perform that action at this time.
0 commit comments