123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
-
- console.log("_e I.js")
- console.log("_e ")
-
- console.log("_e ....z",localStorage)
- clog = console.log
- glob_u= window.glob_u|| {}
-
- function lsto_event(){
- clog("page-lsto_event:",arguments,this)
- }
-
-
-
-
-
- function rec_on_page(e){
- // clog("jx rec_on_page",arguments,this)
- // if (e.PAGE_MC_INIT)
- }
- function send_from_page(){
- window.postMessage({"type":"FROM_PAGE",o:{a:1}})
- }
-
- function port_msg_1(){
- clog("_jx port_msg_1",arguments,this)
-
- }
- function port_msg_err_1(){
- clog("_jx port_msg_err_1",arguments,this)
- }
-
-
- function dec_info(fn,err,args,that){
- var s = err.stack.split("\n")[2]
- // var err = new Error()
- inc_vx(glob_u.trc.m,err.stack)
- inc_vx(glob_u.trc.m2,s)
- // clog(err.stack,err)
- // clog("DEC:",fn.name,s,[err],args,that)
- }
-
-
- function dec_json(fn){
- // clog(fn,[fn])
- return function(){
- var err =new Error()
- var s= dec_info(fn,err,arguments,this)
- let ret = fn(...arguments)
- if (fn.name.includes("wJSON")){
-
- clog("DEC:",fn.name,s,ret,[err],arguments,this)
- }
- // clog("DEC:",fn.name,s,[err],arguments,this)
- // clog("DEC:",fn.name,s,ret,[err],arguments,this)
- return ret
- return fn(...arguments)
- }
- }
-
-
-
- function init_page_mc(){
- glob_u.m_ch = new MessageChannel();
- var channel = glob_u.m_ch
- var port1 = channel.port1
- port1.onmessage = port_msg_1
- port1.onmessageerror = port_msg_err_1
-
- // postMessage({"type":"CS_MC_INIT",o:{port1}})
- postMessage("PAGE_MC_INIT", "*", [
- channel.port2
- ]);
-
-
- }
-
-
- function q_run_once(){
- if (glob_u.init){return}
- glob_u.init=1
- glob_u.trc={
- m:new Map(),
- m2:new Map(),
- }
- glob_u.JSON = {
- parse:JSON.parse,
- stringify:JSON.stringify,
- isRawJSON:JSON.isRawJSON,
- rawJSON: JSON.rawJSON,
- }
- JSON.parse = dec_json(JSON.parse)
- JSON.stringify = dec_json(JSON.stringify)
- JSON.isRawJSON = dec_json(JSON.isRawJSON)
- JSON.rawJSON = dec_json(JSON.rawJSON)
-
- window.addEventListener('storage', lsto_event)
- window.addEventListener('message', rec_on_page)
-
-
- window.addEventListener('storage', lsto_event)
-
-
- }
- q_run_once()
-
- function jdec(n,s){
- clog("JDEC",[n,s])
- var JSON_fn = function JSON_fn(){
- // var ret = JSON[n]
- var ret = JSON[n](...arguments)
- // return JSON[n](...arguments)
- // clog(n,s,ret,arguments)
- return ret
- }
- JSON[n] = JSON_fn
- return JSON_fn
- }
- // jdec("stringify","z")
- /*
- jdec("parse","z")
- jdec("isRawJSON","z")
- jdec("rawJSON","z")
- */
- clog("~~~~~~~~~~~`2")
-
-
- // function init_page_mc(){}
-
-
-
-
|