Skip to content

Instantly share code, notes, and snippets.

@asyncins
Created July 7, 2020 13:02
Show Gist options
  • Save asyncins/1b7e04c6d459e246bcccef46c5a90d91 to your computer and use it in GitHub Desktop.
Save asyncins/1b7e04c6d459e246bcccef46c5a90d91 to your computer and use it in GitHub Desktop.
[hook window property]
(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;
}
})
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment