Guest User

Untitled

a guest
May 22nd, 2018
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. on the client side:
  2. function monitor(){
  3. dojo.xhr({
  4. method:"POST",
  5. url:"/TestCalls",
  6. headers:{
  7. "Accept":"message/json",
  8. "Content-Type":"message/json"
  9. },
  10. postData: dojo.toJson([{method:"subscribe", subscribe:"hour"}]),
  11. handleAs: "json"
  12. }).addCallback(function(results){
  13. dojo.forEach(results, dojox.data.restListener);
  14. monitor();
  15. });
  16. }
  17. monitor();
  18.  
  19. in the model file on the server
  20. var hub = require("tunguska/hub");
  21. Model("TestCalls", store, {
  22. "put": function(object){
  23. object.groups.forEach(function(group){
  24. hub.publish("TestCalls/" + group, {event:"put", source:object.id, result: object});
  25. });
  26. ...
Add Comment
Please, Sign In to add comment