@@ -11,20 +11,20 @@ export default {
1111 whiteList : [ "https://*.facebook.com/*" , "https://*.messenger.com/*" ] ,
1212
1313 onDocumentStart : ( ) => {
14- // const WebSocketOrig = window.WebSocket;
14+ const WebSocketOrig = window . WebSocket ;
1515
16- // window.WebSocket = function fakeConstructor(dt, config) {
17- // const websocket_instant = new WebSocketOrig(dt, config);
18- // websocket_instant.addEventListener("message", async function (achunk) {
19- // // const utf8_str = new TextDecoder("utf-8").decode(achunk.data);
20- // // Do something here
21- // // console.log(utf8_str);
22- // });
23- // return websocket_instant;
24- // };
16+ window . WebSocket = function fakeConstructor ( dt , config ) {
17+ const websocket_instant = new WebSocketOrig ( dt , config ) ;
18+ websocket_instant . addEventListener ( "message" , async function ( achunk ) {
19+ // const utf8_str = new TextDecoder("utf-8").decode(achunk.data);
20+ // Do something here
21+ // console.log(utf8_str);
22+ } ) ;
23+ return websocket_instant ;
24+ } ;
2525
26- // window.WebSocket.prototype = WebSocketOrig.prototype;
27- // window.WebSocket.prototype.constructor = window.WebSocket;
26+ window . WebSocket . prototype = WebSocketOrig . prototype ;
27+ window . WebSocket . prototype . constructor = window . WebSocket ;
2828
2929 // window.addEventListener(
3030 // "message",
@@ -34,19 +34,21 @@ export default {
3434 // !1
3535 // );
3636
37- let emptyFunc = void 0 ;
38- Object . defineProperty ( window , "__d" , {
39- get : ( ) => emptyFunc ,
40- set : ( i ) => {
41- const c = new Proxy ( i , {
42- apply : async function ( moduleName , dependencies , args ) {
43- console . log ( arguments ) ;
44- return moduleName ( ...args ) ;
45- } ,
46- } ) ;
47- emptyFunc = c ;
48- } ,
49- } ) ;
37+ console . log ( window . __d ) ;
38+ // let emptyFunc = void 0;
39+ // Object.defineProperty(window, "__d", {
40+ // get: () => emptyFunc,
41+ // set: (i) => {
42+ // const c = new Proxy(i, {
43+ // apply: async function (moduleName, dependencies, args) {
44+ // console.log(arguments);
45+ // // return moduleName(...args);
46+ // return i.apply(this, arguments);
47+ // },
48+ // });
49+ // emptyFunc = c;
50+ // },
51+ // });
5052 } ,
5153
5254 onDocumentIdle : ( ) => {
0 commit comments