Created
July 7, 2020 13:02
-
-
Save asyncins/1b7e04c6d459e246bcccef46c5a90d91 to your computer and use it in GitHub Desktop.
[hook window property]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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