From f1a670749df3c5a033d050073f50df7be4d3c530 Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Mon, 26 May 2014 10:03:27 -0700 Subject: [PATCH] Simplify with getLastMessage() --- tutorial.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tutorial.html b/tutorial.html index df0a3a8..a9cb637 100644 --- a/tutorial.html +++ b/tutorial.html @@ -116,8 +116,8 @@ cosmo.subscribe('testsubject');
  • Change your test script:
    var cosmo = new Cosmopolite();
     cosmo.subscribe('testsubject', 1).then(function() {
    -  var msgs = cosmo.getMessages('testsubject');
    -  alert(msgs[msgs.length - 1]['message']);
    +  var msg = cosmo.getLastMessage('testsubject');
    +  alert(msg['message']);
     });
  • Your test page should generate an alert popup showing the last message sent