Upgrade domvm to 3.4.5

This commit is contained in:
Timothy Farrell 2018-09-11 15:18:19 -05:00
parent c2d28f0605
commit f8caddaf64
2 changed files with 14 additions and 4 deletions

View File

@ -15,7 +15,7 @@
"backgroundtask": "~1.0.0", "backgroundtask": "~1.0.0",
"body-parser": "~1.18.3", "body-parser": "~1.18.3",
"date-fns": "~1.29.0", "date-fns": "~1.29.0",
"domvm": "~3.2.1", "domvm": "~3.4.5",
"exif-parser": "~0.1.9", "exif-parser": "~0.1.9",
"express": "~4.16.3", "express": "~4.16.3",
"frptools": "~3.2.0", "frptools": "~3.2.0",

View File

@ -1,8 +1,18 @@
import { log, group, groupEnd } from '../utils/console.js'; import { call } from 'frptools';
export const streamConfig = { export const streamConfig = {
is: s => s && typeof s.subscribe === 'function', is: s => s && typeof s.subscribe === 'function',
val: s => s(),
sub: (s, fn) => s.subscribe(fn), sub: (s, fn) => s.subscribe(fn),
unsub: s => s() off: subList => subList.forEach(call),
on: (accum, vm) => {
const redraw = () => vm.redraw();
return accum.map(s => (streamConfig.is(s) ? streamConfig.sub(s, redraw) : s()));
},
val: (s, accum) =>{
if (streamConfig.is(s)) {
accum.push(s);
return s();
}
return s;
}
}; };