/tincan_queue

Javascript helper library for Tin Can (the Experience API) to work with limited connectivity : queues up Tin Can statements using local storage then sends in bulk to LRS

Primary LanguageJavaScriptApache License 2.0Apache-2.0

Tin Can Queue

Build Status

Copyright Michael Dawson (mike@mike-dawson.net) 2014. Licensed under the Apache 2.0 License - see LICENSE file for details.

This is a Javascript helper library for Tin Can (the Experience API) to work with limited connectivity : queues up Tin Can statements using local storage then sends in bulk to LRS.

Base usage:

Make a queue object:

var myQueue = new TinCanQueue();

Queue some statements:

Create Tin Can statements and make sure you use { 'storeOriginal' : true } as the final argument because its needed to correctly stringify and restore. Add them to the queue with:

myQueue.queueStatement(myTinCanStmtObject);

Send the queue of statements to the LRS:

Give the sendStatementQueue your tin can object and the queue will get sent:

myQueue.sendStatementQueue(tinCanObject);

Running the tests:

Use the grunt file. Depends on PhantomJS : important - install the following packages on Ubuntu for this to cooperate:

$ sudo apt-get install libfontconfig1 fontconfig libfontconfig1-dev libfreetype6-dev
$ sudo npm install
$ grunt