From 0b245a00c42e749707cad306ac112fdb97e4a6a3 Mon Sep 17 00:00:00 2001 From: mmcw-dev Date: Sat, 21 Oct 2017 12:21:15 -0400 Subject: [PATCH] Log after frame is complete --- index.js | 7 +++---- lib/intval/index.js | 5 +++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index a92753e..5314588 100644 --- a/index.js +++ b/index.js @@ -121,11 +121,10 @@ function rDelay (req, res, next) { function rFrame (req, res, next) { log.info('/frame', { method : req.method }) - intval.frame(true, 0, () => { - log.info('frame stopped') + intval.frame(true, 0, (dir, len) => { + res.send({ dir : true, len : len}) + return next() }) - res.send({}) - return next() } function rStatus (req, res, next) { diff --git a/lib/intval/index.js b/lib/intval/index.js index 20b9dae..81f56ad 100644 --- a/lib/intval/index.js +++ b/lib/intval/index.js @@ -297,7 +297,6 @@ intval.frame = function (dir = null, time = null, cb = () => {}) { } if (time !== 0) { intval._state.frame.paused = true - if (dir) { setTimeout(intval._pause, intval._frame.open) //log.info('frame', { pausing : time + intval._frame.open }) @@ -314,7 +313,9 @@ intval.frame = function (dir = null, time = null, cb = () => {}) { }, time + intval._frame.closed) } } - intval._state.frame.cb = cb + intval._state.frame.cb = (len) => { + cb(dir, len) + } } /** * Start a sequence of frames, using defaults or explicit instructions