tao-test/app/taoItems/views/js/legacyApi/taoLegacyApi.min.js

33 lines
3.5 KiB
JavaScript

function ItemApi(){this.implementation=null;this.pendingCalls=new Array();}
ItemApi.prototype.setImplementation=function(implementation){this.implementation=implementation;for(var i=0;i<this.pendingCalls.length;i++){this.pendingCalls[i](implementation);};this.pendingCalls=new Array();};ItemApi.prototype.__delegate=function(call){if(this.implementation!=null){return call(this.implementation);}else{this.pendingCalls.push(function(implementation){return call(implementation);});}};ItemApi.prototype.saveResponses=function(valueArray){this.__delegate((function(valueArray){return function(implementation){implementation.saveResponses(valueArray);}})(valueArray));};ItemApi.prototype.saveScores=function(valueArray){this.__delegate((function(valueArray){return function(implementation){implementation.saveScores(valueArray);}})(valueArray));};ItemApi.prototype.traceEvents=function(eventArray){this.__delegate((function(eventArray){return function(implementation){implementation.traceEvents(eventArray);}})(eventArray));};ItemApi.prototype.beforeFinish=function(callback){this.__delegate((function(callback){return function(implementation){implementation.beforeFinish(callback);}})(callback));};ItemApi.prototype.finish=function(){this.__delegate(function(implementation){implementation.finish();});};ItemApi.prototype.setVariable=function(identifier,value){this.__delegate((function(identifier,value){return function(implementation){implementation.setVariable(identifier,value);}})(identifier,value));};ItemApi.prototype.getVariable=function(identifier,callback){this.__delegate((function(identifier,callback){return function(implementation){implementation.getVariable(identifier,callback);}})(identifier,callback));};
var RECOVERY_CONTEXT_PREFIX='rc_';var _itemApi=new ItemApi();function onItemApiReady(){_itemApi.setImplementation(itemApi);};function getEndorsment(){}
function setEndorsment(endorsment){}
function getScore(){}
function setRecoveryContext(identifier,value){_itemApi.setVariable(RECOVERY_CONTEXT_PREFIX+identifier,value);}
function getRecoveryContext(identifier,callback){_itemApi.getVariable(RECOVERY_CONTEXT_PREFIX+identifier,callback);}
function setScore(score){values={SCORE:score};_itemApi.saveScores(values);}
function getScoreRange(){}
function setScoreRange(max,min){}
function getAnsweredValues(){}
function setAnsweredValues(encodedValues){var values=JSON.parse(encodedValues);_itemApi.saveResponses(values);}
function getSubject(){}
function getSubjectLogin(){}
function getSubjectName(){}
function getItem(){return taoStack.getTaoVar(URI.ITEM);}
function getTest(){}
function getDelivery(){}
function setUserVar(key,value){var arr={};arr[key]=value;_itemApi.saveScores(arr);}
function getUserVar(key){}
var STATE={'ITEM':{'PRE_FINISHED':'pre_item_finished','FINISHED':'item_finished','POST_FINISHED':'post_item_finished'}};function onFinish(callback){$(window).bind(STATE.ITEM.FINISHED,callback);}
function beforeFinish(callback){$(window).bind(STATE.ITEM.PRE_FINISHED,callback);}
function afterFinish(callback){$(window).bind(STATE.ITEM.POST_FINISHED,callback);}
_itemApi.beforeFinish(function(){$(window).trigger(STATE.ITEM.PRE_FINISHED);$(window).trigger(STATE.ITEM.FINISHED);$(window).trigger(STATE.ITEM.POST_FINISHED);});function finish(){_itemApi.finish();}
function getToken(){}
function initDataSource(environment,settings){}
function initManualDataSource(source){}
function initPush(environment,settings){}
function push(){}
beforeFinish(push);function logEvent(elementName,eventType,data){}
function logCustomEvent(eventName,data){}
function initEventServices(var1,var2){};