Comments (6)
Hello! Just making sure, you have seen the documentation in the js file, right?
Get activity state from the LRS
@param {string} activityid the id of the Activity this state is about
@param {object} agent the agent this Activity state is related to
@param {string} [stateid] the id of the state, if not included, the response will be a list of stateids
associated with the activity and agent)
@param {string} [registration] the registraton id associated with this state
@param {object} [since] date object or date string telling the LRS to return objects newer than the date supplied
@param {function} [callback] function to be called after the LRS responds
to this request (makes the call asynchronous)
the function will be passed the XMLHttpRequest object
@return {object} xhr response object or null if 404
@example
ADL.XAPIWrapper.getState("http://adlnet.gov/expapi/activities/question",
{"mbox":"mailto:[email protected]"}, "questionstate");
>> {info: "the state info"}
You should just need to include the stateid in the call if I am not mistaken.
Also, if you are trying to save the sate info, you should be using sendState which sends the information to your LRS.
from xapiwrapper.
sendState() is what you want.
The documentation for the function itself is a bit slim, admittedly.
from xapiwrapper.
Hi FlorianTolk
I've read document with xAPIWrapper before i create this issue and I know how to send state with sendState. But i am not know how to store the state when use getState. Does it need to be store old state in localStorage by myself.
Example : I want to change old state if old state is {"info":"1"}, but not a simple way to store old state etag.
- send state id questionstate is {"info":"1"}
- get state id questionstate , LRS server will return {"info":"1"}.
- I want to change questionstate, so i will send state id questionstate is {"info":"2"} and old state sha1 with {"info":"1"}.
var stateval = {"info":"2"};
var oldstateval = {"info":"1"};
var oldstatevalHash = ADL.XAPIWrapper.hash(JSON.stringify(oldstateval));
ADL.XAPIWrapper.sendState("http://adlnet.gov/expapi/activities/question",
{"mbox":"mailto:[email protected]"},
"questionstate", null, stateval,oldstatevalHash);
from xapiwrapper.
You can store something locally or keep everything on the LRS -- it's up to you, really.
If you need assistance storing values on a local machine, then there are plenty of resources online for how to do that. :-)
I'll be closing this issue at the end of the week if there aren't any issues related to functionality.
from xapiwrapper.
After reading your question again: No there isn't any out-of-the-box functionality to save a history of state values.
But, there's nothing stopping you from saving your prior state as another state itself, or just attaching the history to your object itself (not recommended for performance reasons).
// The objects you pass can be anything serializable
//
var stateval = {"info":"2", "version": 1};
var oldstateval = {"info":"1", "version": 0};
var oldstatevalHash = ADL.XAPIWrapper.hash(JSON.stringify(oldstateval));
// Send the most recent one, which has its version number
//
ADL.XAPIWrapper.sendState("http://adlnet.gov/expapi/activities/question",
{"mbox":"mailto:[email protected]"},
"questionstate", null, stateval);
// Send the previous one, which also has its version number, but send it to a unique
// IRL based on that version and the state ID
//
ADL.XAPIWrapper.sendState("http://adlnet.gov/expapi/activities/question",
{"mbox":"mailto:[email protected]"},
"questionstate/" + oldStateVal["version"], null, oldstateval );
from xapiwrapper.
OK, I will customize the implementation of the old state of storage.
Thank you very much.
from xapiwrapper.
Related Issues (20)
- Legacy branch HOT 2
- Is not getLRSObject a spec violation? HOT 3
- ADL.xapiutil.getActorId HOT 2
- ERR_CONNECTION_REFUSED HOT 6
- Cannot Get statements, but also without error
- No build process for examples? Should I manually install dependencies? HOT 1
- Documentation Link in main Readme is a 404 HOT 3
- There is no cmi.interaction activity type
- Not possible to set contextActivities.grouping via addGroupingActivity()
- Path issue in Gruntfile HOT 1
- addGroupingActivity() calls always initiate an empty array HOT 2
- empty query HOT 4
- Feature request: Make `getQueryVariable` iframe aware or at least allow to pass launch parameters to `launch` explicitly
- Statements no longer sent when browser (Chrome) closed HOT 2
- Stop sending statements when about internet HOT 2
- Auto generate statement.id HOT 3
- Can't send xAPI statements from H5PStandalone
- Why `mocha` in dependencies?
- Handle + sign in URL query string parameters HOT 1
- Avoid blocking JavaScript execution
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xapiwrapper.