File tree Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -804,6 +804,11 @@ declare namespace Router {
804
804
*/
805
805
export function getActivePage ( ) : Lightning . Component | null ;
806
806
807
+ /**
808
+ * Returns the reference of the active Page instance
809
+ */
810
+ export function deletePage ( param : string ) : void ;
811
+
807
812
/**
808
813
* Returns the active route path blueprint
809
814
*/
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ import {
44
44
beforeEachRoute ,
45
45
getActiveHash ,
46
46
getActiveRoute ,
47
+ deleteCurrentInstance ,
47
48
} from './utils/router'
48
49
49
50
import { focusWidget , getActiveWidget , restoreFocus } from './utils/widgets'
@@ -517,6 +518,10 @@ const root = () => {
517
518
}
518
519
}
519
520
521
+ const deletePage = ( param ) => {
522
+ deleteCurrentInstance ( param )
523
+ }
524
+
520
525
// export API
521
526
export default {
522
527
startRouter,
@@ -530,6 +535,7 @@ export default {
530
535
// warning
531
536
return getActivePage ( )
532
537
} ,
538
+ deletePage,
533
539
getActiveRoute,
534
540
getActiveHash,
535
541
focusWidget,
Original file line number Diff line number Diff line change @@ -122,6 +122,12 @@ export let routes = new Map()
122
122
*/
123
123
export let components = new Map ( )
124
124
125
+ /**
126
+ * Copy of components created at boot time
127
+ * @type {Map<string, object> }
128
+ */
129
+ export let bootcomponents = new Map ( )
130
+
125
131
/**
126
132
* Flag if router has been initialised
127
133
* @type {boolean }
@@ -218,6 +224,7 @@ const setup = config => {
218
224
pagesHost . a ( type )
219
225
}
220
226
}
227
+ bootcomponents . set ( path , type )
221
228
components . set ( path , type )
222
229
}
223
230
} else {
@@ -299,6 +306,14 @@ export const getComponent = route => {
299
306
}
300
307
return null
301
308
}
309
+
310
+ // repace the current with boot instance
311
+ export const deleteCurrentInstance = route => {
312
+ if ( bootcomponents . has ( route ) ) {
313
+ components . set ( route , bootcomponents . get ( route ) )
314
+ }
315
+ }
316
+
302
317
/**
303
318
* Test if router needs to update browser location hash
304
319
* @returns {boolean }
You can’t perform that action at this time.
0 commit comments