Topic: Remove item from session
Hi every one.
Does any of you know how to remove an item from the session using JS SDK?
Lets say i start a new session and load units to it with this code:
var mySess=wialon.core.Session.getInstance();
mySess.initSession("https://hst-api.wialon.com");
mySess.loadLibrary("itemProfileFields");
mySess.loginToken(TOKEN,"",function (code) {
if (code) console.log(wialon.core.Errors.getErrorText(code));
var flags = wialon.item.Item.dataFlag.base;
mySess.updateDataFlags(
[{type: "type", data: "avl_unit", flags: flags, mode: 0}],
function (code) {
console.log(mySess.getItems("avl_unit"));
});
})
;
Then while this session stays active add a new unit to it through CMS, after executing mySess.updateDataflags() and mySess.getItems("avl_unit") i get previous loaded units +1.
But after going again to CMS and revoking access to one unit I just cant find a way to unload it from the active session.
I've tried changing the flags, type, data and mode params in the updateDataFlags method as described in these links:
https://sdk.wialon.com/wiki/en/kit/remo … datafalags
https://sdk.wialon.com/wiki/en/local/re … data_flags
Also checked mySess.searchItems() and myUser.getItemsAccess(), both responses have the right number of units.
Is there any way to update the avl_unit? also is there any way to set a Listener to detech those changes?