From 959049af5915251fa90eb767c66e4726be1ca190 Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Tue, 17 Jun 2014 21:28:47 -0700 Subject: [PATCH] Add connected() function. --- static/cosmopolite.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/static/cosmopolite.js b/static/cosmopolite.js index 3cb941f..80f2c0e 100644 --- a/static/cosmopolite.js +++ b/static/cosmopolite.js @@ -265,6 +265,15 @@ Cosmopolite.prototype.shutdown = function() { }; +/** + * @see https://www.cosmopolite.org/reference#connected + * @return {boolean} + */ +Cosmopolite.prototype.connected = function() { + return this.channelState_ == Cosmopolite.ChannelState_.OPEN; +}; + + /** * @see https://www.cosmopolite.org/reference#subscribe * @param {Cosmopolite.typeSubjectLoose|Array.}