UNPKG

@openhps/core

Version:

Open Hybrid Positioning System - Core component

15 lines 390 B
import { SinkNode } from '../SinkNode'; /** * @category Sink node */ export class CallbackSinkNode extends SinkNode { constructor(callback = () => null, options) { super(options); this.callback = callback; } onPush(frame, options) { return new Promise((resolve, reject) => { Promise.resolve(this.callback(frame, options)).then(resolve).catch(reject); }); } }