Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
send(event: ChannelEvent): Promise {
const iframeWindow = this.getWindow();
if (!iframeWindow) {
return new Promise((resolve, reject) => {
this.buffer.push({ event, resolve, reject });
});
}
const data = stringify({ key: KEY, event }, { maxDepth: 15 });
// TODO: investigate http://blog.teamtreehouse.com/cross-domain-messaging-with-postmessage
// might replace '*' with document.location ?
iframeWindow.postMessage(data, '*');
return Promise.resolve(null);
}
_.fn('set', function(key: string, data: object) {
return _.set(this._area, this._in(key), stringify(data, { maxDepth: 50 }));
});
_.fn('get', function(key: string, alt: string) {