Skip to content

Instantly share code, notes, and snippets.

@asyncins
Created July 7, 2020 13:02

Revisions

  1. asyncins created this gist Jul 7, 2020.
    17 changes: 17 additions & 0 deletions hook_window_property.script
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    (function() {
    'use strict';

    var t = window.xxxxx // 指定 window 对象
    Object.defineProperty(window, 'xxxxx', {
    get: function(){
    console.log("Get window property");
    return t;
    },
    set: function(val){
    console.log("Set window property", val);
    debugger;
    t = val
    return val;
    }
    })
    })();