21 lines
493 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* web页面植入脚本用于授权等一系列操作。
*/
console.log('注入了页面');
var port = chrome.extension.connect({ name: 'data' });
window.addEventListener('message', event => {
if (event.data.type === undefined) {
return;
}
console.log('接受到消息', event.data);
switch (event.data.type) {
case 'sendToken':
port.postMessage(event.data);
break;
default:
console.error('未知的事件', event);
}
});