feat: Add a popout option on webwidget (#1174)

* feat: Add a popout option on webwidget
This commit is contained in:
Pranav Raj S 2020-08-28 17:39:46 +05:30 committed by GitHub
parent ce13efd273
commit 45cd949c40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 347 additions and 127 deletions

View file

@ -1,3 +1,5 @@
import { WOOT_PREFIX } from './constants';
export const isEmptyObject = obj =>
Object.keys(obj).length === 0 && obj.constructor === Object;
@ -16,4 +18,11 @@ export const IFrameHelper = {
'*'
);
},
isAValidEvent: e => {
const isDataAString = typeof e.data === 'string';
const isAValidWootEvent =
isDataAString && e.data.indexOf(WOOT_PREFIX) === 0;
return isAValidWootEvent;
},
getMessage: e => JSON.parse(e.data.replace(WOOT_PREFIX, '')),
};