@signiant/media-shuttle-sdk-base
Version:
The base parent sdk behind other media shuttle sdks (e.g. media-shuttle-sdk)
27 lines (26 loc) • 1.02 kB
JavaScript
/* eslint-disable import/first */
import { v4 as uuid } from 'uuid';
// eslint-disable-next-line @typescript-eslint/no-var-requires
var forge = require('node-forge');
forge.options.usePureJavaScript = true;
var Registration = /** @class */ (function () {
function Registration(channelObject) {
this._channelString = forge.util.encode64(JSON.stringify(channelObject));
}
Registration.prototype.initApp = function () {
var url = "sigclient://msg=".concat(this._channelString);
if (typeof protocolHandler !== 'undefined') {
// A custom protocol handler has been defined. Use it to open the sigclient:// URL
protocolHandler(url);
}
else {
var iframe = document.createElement('iframe');
iframe.id = "iframeID-".concat(uuid());
iframe.style.display = 'none';
iframe.src = url;
document.body.appendChild(iframe);
}
};
return Registration;
}());
export default Registration;