-
Notifications
You must be signed in to change notification settings - Fork 0
/
offline_xapi_wrapper.js
53 lines (43 loc) · 1.21 KB
/
offline_xapi_wrapper.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
var actor = {
"objectType": "Agent",
"account": {
"homePage": "http://www.example.com",
"name": "1625378"
}
};
window.xapiWrapper = Object.create(window.ADL.XAPIWrapper);
Object.assign(window.xapiWrapper, {
lrs: {
actor: JSON.stringify(actor),
activity_id: "http://www.example.com/LA1/001/intro",
endpoint: "http://lrs.example.com/lrslistener/",
registration: "760e3480-ba55-4991-94b0-01820dbd23a2"
},
getState: function(activityid, agent, stateid, registration, since, callback) {
var existingState = Cookies.get(stateid);
if (existingState) {
return callback(null, {
status: 200,
response: existingState
});
}
return callback(null, {
status: 404,
response: null
});
},
sendStatement: function(stmt, callback) {
console.log("xAPI statement sent:");
console.log(JSON.stringify(stmt));
return callback();
},
sendState: function(activityid, agent, stateid, registration, stateval, matchHash, noneMatchHash, callback) {
console.log("xAPI state sent - " + stateid + ":");
console.log(stateval);
Cookies.set(stateid, stateval);
return true;
},
updateAuth: function(a, b, c) {
return true;
}
});