Lazyify iterating subscriptions array un subscribeToRender
This allows the array to be manipulated between subscribeToRender call and view unmounting.
This commit is contained in:
parent
85447df830
commit
eeaff42e16
@ -6,9 +6,13 @@ import { error } from '../services/console.js';
|
|||||||
|
|
||||||
export function subscribeToRender(vm, subscribables, subscriptions) {
|
export function subscribeToRender(vm, subscribables, subscriptions) {
|
||||||
const redraw = (...args) => vm.redraw();
|
const redraw = (...args) => vm.redraw();
|
||||||
const subList = subscribables.map(s => s.subscribe(redraw)).concat(subscriptions);
|
const subList = subscribables.map(s => s.subscribe(redraw));
|
||||||
|
|
||||||
vm.config({ hooks: { willUnmount: () => subList.forEach(call) } });
|
vm.config({
|
||||||
|
hooks: {
|
||||||
|
willUnmount: () => subList.concat(subscriptions).forEach(call)
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function patchRefStyle(ref, style, evt, node, vm) {
|
export function patchRefStyle(ref, style, evt, node, vm) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user