Skip to content

Commit

Permalink
introduce handling of the new onClearSnapshot event and bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
mone committed Jul 24, 2013
1 parent da38c90 commit 6ed0b83
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
13 changes: 10 additions & 3 deletions LightstreamerStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ define([
});

if(!("id" in o)){ o["id"] = key; };

if(!("item" in o)){ o["item"] = updateInfo.getItemPos(); };
return o;
};

Expand Down Expand Up @@ -75,7 +75,7 @@ define([
}
}

//TODO conflicts may arise if there is an "id" field in the field list
//TODO conflicts may arise if there is an "id" or "item" field in the field list
if (options.kind) {
this.kind = options.kind;
} else if (options.mode == "MERGE" || options.mode == "RAW") {
Expand All @@ -89,7 +89,7 @@ define([
var self = this;
this.subscription.addListener({
onItemUpdate: function(updateInfo) {
var key = self.getUpdateKey(updateInfo);
var key = self.getUpdateKey(updateInfo);
var updateObj = translate(key,updateInfo,self.data.item(key));
self.put(updateObj);
},
Expand All @@ -103,6 +103,13 @@ define([
onUnsubscription: function() {
// we may want to move the "onSubscription code" here
self.clear();
},

onClearSnapshot: function(itemName,itemPos) {
//TODO we may want to place a reverse index instead of querying like this
QueryResults(self.queryEngine({item:itemPos})(self.data.getValueList())).forEach(function(obj) {
self.remove(obj["id"]);
});
}
});

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# LightstreamerStore 1.0 for Dojo
# LightstreamerStore 1.1 for Dojo
This package is designed to integrate the Lightstreamer libraries with the dojo.store APIs. This object-based store is written so that the query method returns an observable QueryResults object; all you need to do is attach a callback function to the "observe" method of the results to listen for any updates from the server. Each object returned by the server is passed to anything assigned to the "observe" function, which makes it simple to consume.

# Requisites
Expand All @@ -12,4 +12,4 @@ AFL or BSD license

# Lightstreamer Compatibility Notes

Compatible with Lightstreamer JavaScript Client 6.0
Compatible with Lightstreamer JavaScript Client 6.1
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lightstreamer-store",
"version": "1.0",
"version": "1.1",
"description": "Lightstreamer backed implementation of dojo/store",
"licenses": [
{
Expand Down

0 comments on commit 6ed0b83

Please sign in to comment.