@daily-co/daily-js
Advanced tools
Comparing version 0.9.999 to 0.10.0
@@ -288,2 +288,3 @@ // Type definitions for daily-js | ||
enable_network_ui?: boolean; | ||
enable_prejoin_ui?: boolean; | ||
start_video_off?: boolean; | ||
@@ -315,2 +316,3 @@ start_audio_off?: boolean; | ||
enable_network_ui?: boolean; | ||
enable_prejoin_ui?: boolean; | ||
}; | ||
@@ -317,0 +319,0 @@ dialInPIN?: string; |
{ | ||
"name": "@daily-co/daily-js", | ||
"version": "0.9.999", | ||
"version": "0.10.0", | ||
"engines": { | ||
@@ -5,0 +5,0 @@ "node": ">=10.0.0" |
@@ -25,3 +25,3 @@ import ScriptMessageChannel from './ScriptMessageChannel'; | ||
) { | ||
const msg = evt.data; | ||
const msg = { ...evt.data }; | ||
// console.log('[WebMessageChannel] received call machine message', msg); | ||
@@ -103,2 +103,50 @@ delete msg.from; | ||
} | ||
// Expects msg to already be packaged with all internal metadata fields | ||
// (what, from, callFrameId, etc.) | ||
forwardPackagedMessageToCallMachine(msg, iframe, newCallFrameId) { | ||
msg.callFrameId = newCallFrameId; | ||
const w = iframe ? iframe.contentWindow : window; | ||
// console.log( | ||
// '[WebMessageChannel] forwarding packaged message to call machine', | ||
// msg | ||
// ); | ||
w.postMessage(msg, '*'); | ||
} | ||
// Listener will be given packaged message with all internal metadata fields | ||
// (what, from, callFrameId, etc.) | ||
addListenerForPackagedMessagesFromCallMachine(listener, callFrameId) { | ||
const wrappedListener = (evt) => { | ||
// console.log( | ||
// '[WebMessageChannel] received packaged call machine message', | ||
// msg | ||
// ); | ||
if ( | ||
evt.data && | ||
evt.data.what === 'iframe-call-message' && | ||
// make callFrameId addressing backwards-compatible with | ||
// old versions of the library, which didn't have it | ||
(evt.data.callFrameId ? evt.data.callFrameId === callFrameId : true) && | ||
(evt.data.from ? evt.data.from !== 'module' : true) | ||
) { | ||
const msg = evt.data; | ||
listener(msg); | ||
} | ||
}; | ||
// For now we're still using the listener itself as the key, like in the | ||
// other addListener* methods. We should probably change this everywhere to | ||
// use a proper unique id. | ||
this._wrappedListeners[listener] = wrappedListener; | ||
window.addEventListener('message', wrappedListener); | ||
return listener; | ||
} | ||
removeListenerForPackagedMessagesFromCallMachine(listenerId) { | ||
const wrappedListener = this._wrappedListeners[listenerId]; | ||
if (wrappedListener) { | ||
window.removeEventListener('message', wrappedListener); | ||
delete this._wrappedListeners[listenerId]; | ||
} | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
391357
4592
3