diff --git a/www/common/sframe-common.js b/www/common/sframe-common.js new file mode 100644 index 000000000..58dda18b1 --- /dev/null +++ b/www/common/sframe-common.js @@ -0,0 +1,23 @@ +define([ + 'jquery', + '/common/sframe-chainpad-netflux-inner.js', + +], function ($, CpNfInner) { + var common = {}; + var cpNfInner; + + // Chainpad Netflux Inner + common.startRealtime = function (options) { + if (cpNfInner) { return cpNfInner; } + cpNfInner = CpNfInner.start(options); + return cpNfInner; + }; + + + common.isLoggedIn = function () { + if (!cpNfInner) { throw new Error("cpNfInner is not ready!"); } + return cpNfInner.metadataMgr.getPrivateData().accountName; + }; + + return common; +});