1class _Mercury { 2 frameWindow; 3 4 constructor(frameWindow) { 5 this.frameWindow = frameWindow; 6 } 7 8 async delegate(f, args) { 9 let savedResolve; 10 const p = new Promise(resolve => (savedResolve = resolve)); 11 12 const channel = new MessageChannel(); 13 14 channel.port1.onmessage = event => { 15 const { msg } = event.data; 16 if (savedResolve) { 17 if (msg !== undefined) { 18 savedResolve(msg); 19 } else { 20 savedResolve(); 21 } 22 } 23 }; 24 25 this.frameWindow.postMessage({ f, args }, '*', [channel.port2]); 26 27 return p; 28 } 29 30 async canReceivePush(appId, zid, authToken) { 31 return this.delegate('canSend', { appId, zid, authToken }); 32 } 33 34 async optInToPush(appId, zid, authToken, locale = 'en-US') { 35 return this.delegate('beginWebpushTokenCollection', { 36 appId, 37 zid, 38 authToken, 39 locale, 40 isSkipValidation: true, 41 }); 42 } 43} 44 45function insertScopedIfrme() { 46 const dom = window.document; 47 const iframe = dom.createElement('iframe'); 48 iframe.id = 'mercury'; 49 iframe.src = `/scripts/MercurySDK.html`; 50 iframe.style = 'display: none'; 51 dom.body.append(iframe); 52 return iframe; 53} 54 55const scopedFrame = insertScopedIfrme(); 56scopedFrame.addEventListener('load', function () { 57 window.Mercury = new _Mercury(scopedFrame.contentWindow); 58}); 59 60/* 61https://admin.messaging.zynga.com/static/#/templates/game/5002274/template/1404386558 62*/
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.