Lazyify iterating subscriptions array un subscribeToRender

This allows the array to be manipulated between subscribeToRender call and view unmounting.
This commit is contained in:
Timothy Farrell 2017-12-17 21:52:52 -06:00
parent 85447df830
commit eeaff42e16

View File

@ -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) {