Core JavaScript improvements

Almost the entire core.js file has been rewritten to provide greater documentation.

app.channelIsJoined() has been deprecated in favor of app.channelIsActive().
app.channelIsActive() will return a value for a regular channel or private message, so it makes more sense to use "active" over "joined"
Why don't I add app.privateMessageIsActive() instead? Because app.channelIsActive() can kill two birds with one stone.

app.channelMemberCount() now throws a JavaScript exception when used outside a channel.
This commit is contained in:
Michael
2018-07-17 03:35:10 -04:00
parent 632af0b09c
commit c4e164ab71
6 changed files with 225 additions and 165 deletions
@@ -370,19 +370,26 @@ app.serverIsConnected = function(callbackFunction)
}
};
app.channelIsJoined = function(callbackFunction)
app.channelIsActive = function(callbackFunction)
{
var promiseIndex = appInternal.makePromise(callbackFunction);
var dataValue = {"promiseIndex" : promiseIndex};
if (app.isWebKit2()) {
window.webkit.messageHandlers.channelIsJoined.postMessage(dataValue);
window.webkit.messageHandlers.channelIsActive.postMessage(dataValue);
} else {
TextualScriptSink.channelIsJoined(dataValue);
TextualScriptSink.channelIsActive(dataValue);
}
};
app.channelIsJoined = function(callbackFunction)
{
console.warn("app.channelIsJoined() is deprecated. Use app.channelIsActive() instead.");
app.channelIsActive(callbackFunction);
};
app.channelName = function(callbackFunction)
{
var promiseIndex = appInternal.makePromise(callbackFunction);