From 518f3a45afc5573d4e3162c621eba4008438aac6 Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Thu, 22 May 2014 13:14:58 -0700 Subject: [PATCH] Add tutorial section on using keys --- tutorial.html | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tutorial.html b/tutorial.html index 117da20..ebee3b1 100644 --- a/tutorial.html +++ b/tutorial.html @@ -107,6 +107,20 @@ cosmo.subscribe('testsubject');
  • Your test page should generate an alert popup
  • +

    Using keys

    + +
      +
    1. Cosmopolite can be used as a key/value store, with historical data and update notification
    2. +
    3. Use the debug interface to send several messages to testsubject. Some of them should have the key testkey, while others should have different keys or no key.
    4. +
    5. Change your test script: +
      var cosmo = new Cosmopolite();
      +cosmo.subscribe('testsubject', 0, null, ['testkey']).then(function() {
      +  var msg = cosmo.getKeyMessage('testsubject', 'testkey');
      +  alert(msg['message']);
      +});
    6. +
    7. Your test page should generate an alert popup showing the last message sent with that key
    8. +
    +