@@ -114,8 +114,8 @@ export function createInstance (
114
114
* @param {string } instanceId
115
115
*/
116
116
export function destroyInstance ( instanceId ) {
117
- const instance = instances [ instanceId ] || { }
118
- if ( instance . app instanceof instance . Vue ) {
117
+ const instance = instances [ instanceId ]
118
+ if ( instance && instance . app instanceof instance . Vue ) {
119
119
instance . app . $destroy ( )
120
120
}
121
121
delete instances [ instanceId ]
@@ -129,8 +129,8 @@ export function destroyInstance (instanceId) {
129
129
* @param {object } data
130
130
*/
131
131
export function refreshInstance ( instanceId , data ) {
132
- const instance = instances [ instanceId ] || { }
133
- if ( ! ( instance . app instanceof instance . Vue ) ) {
132
+ const instance = instances [ instanceId ]
133
+ if ( ! instance || ! ( instance . app instanceof instance . Vue ) ) {
134
134
return new Error ( `refreshInstance: instance ${ instanceId } not found!` )
135
135
}
136
136
for ( const key in data ) {
@@ -145,8 +145,8 @@ export function refreshInstance (instanceId, data) {
145
145
* @param {string } instanceId
146
146
*/
147
147
export function getRoot ( instanceId ) {
148
- const instance = instances [ instanceId ] || { }
149
- if ( ! ( instance . app instanceof instance . Vue ) ) {
148
+ const instance = instances [ instanceId ]
149
+ if ( ! instance || ! ( instance . app instanceof instance . Vue ) ) {
150
150
return new Error ( `getRoot: instance ${ instanceId } not found!` )
151
151
}
152
152
return instance . app . $el . toJSON ( )
@@ -160,8 +160,8 @@ export function getRoot (instanceId) {
160
160
* @param {array } tasks
161
161
*/
162
162
export function receiveTasks ( instanceId , tasks ) {
163
- const instance = instances [ instanceId ] || { }
164
- if ( ! ( instance . app instanceof instance . Vue ) ) {
163
+ const instance = instances [ instanceId ]
164
+ if ( ! instance || ! ( instance . app instanceof instance . Vue ) ) {
165
165
return new Error ( `receiveTasks: instance ${ instanceId } not found!` )
166
166
}
167
167
const { callbacks, document } = instance
@@ -275,7 +275,6 @@ function createVueModuleInstance (instanceId, moduleGetter) {
275
275
* @return {object }
276
276
*/
277
277
Vue . prototype . $getConfig = function ( ) {
278
- const instance = instances [ this . $instanceId ] || { }
279
278
if ( instance . app instanceof Vue ) {
280
279
return instance . config
281
280
}
0 commit comments