opentok-annotation
Advanced tools
Comparing version 1.0.9 to 1.0.10
{ | ||
"name": "opentok-annotation", | ||
"version": "1.0.9", | ||
"version": "1.0.10", | ||
"description": "OpenTok annotation accelerator pack", | ||
@@ -5,0 +5,0 @@ "main": "dist/opentok-annotation.js", |
@@ -984,3 +984,3 @@ /*! | ||
var batchSignal = function (type, data, toConnection) { | ||
var batchSignal = function (data, toConnection) { | ||
// We send data in small chunks so that they fit in a signal | ||
@@ -994,4 +994,15 @@ // Each packet is maximum ~250 chars, we can fit 8192/250 ~= 32 updates per signal | ||
}; | ||
var type = 'otAnnotation_pen'; | ||
var updateType = function(chunk){ | ||
if (!chunk || !chunk[0] || !chunk[0].selectedItem || !chunk[0].selectedItem.id ){ | ||
return; | ||
} | ||
var id = chunk[0].selectedItem.id; | ||
type = id === 'OT_text' ? 'otAnnotation_text' : 'otAnnotation_pen'; | ||
}; | ||
while (dataCopy.length) { | ||
var dataChunk = dataCopy.splice(0, Math.min(dataCopy.length, 32)); | ||
updateType(dataChunk); | ||
var signal = { | ||
@@ -1012,3 +1023,3 @@ type: type, | ||
updateTimeout = setTimeout(function () { | ||
batchSignal('otAnnotation_pen', batchUpdates); | ||
batchSignal(batchUpdates); | ||
batchUpdates = []; | ||
@@ -1015,0 +1026,0 @@ updateTimeout = null; |
259457
3815