Passage à ASP.NET vNext
This commit is contained in:
parent
ea90fefc31
commit
388b004837
1929 changed files with 104611 additions and 235941 deletions
31
Yavsc/wwwroot/desktopCaptureExtension/content-script.js
Normal file
31
Yavsc/wwwroot/desktopCaptureExtension/content-script.js
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
'use strict';
|
||||
|
||||
// https://chromeextensionsdocs.appspot.com/apps/content_scripts#host-page-communication
|
||||
// - 'content_script' and execution env are isolated from each other
|
||||
// - In order to communicate we use the DOM (window.postMessage)
|
||||
//
|
||||
// app.js | |content-script.js | |background.js
|
||||
// window.postMessage|------->|port.postMessage |----->| port.onMessage
|
||||
// | window | | port |
|
||||
// webkitGetUserMedia|<------ |window.postMessage|<-----| port.postMessage
|
||||
//
|
||||
|
||||
var port = chrome.runtime.connect(chrome.runtime.id);
|
||||
|
||||
port.onMessage.addListener(function(msg) {
|
||||
window.postMessage(msg, '*');
|
||||
});
|
||||
|
||||
window.addEventListener('message', function(event) {
|
||||
// We only accept messages from ourselves
|
||||
if (event.source !== window) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.data.type && ((event.data.type === 'SS_UI_REQUEST') ||
|
||||
(event.data.type === 'SS_UI_CANCEL'))) {
|
||||
port.postMessage(event.data);
|
||||
}
|
||||
}, false);
|
||||
|
||||
window.postMessage({ type: 'SS_PING', text: 'start' }, '*');
|
||||
Loading…
Add table
Add a link
Reference in a new issue