Created
August 23, 2012 05:31
-
-
Save JeffreyZhao/3432991 to your computer and use it in GitHub Desktop.
This file contains 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
var supportDefineProperty = (function () { | |
var i = 0; | |
var getter = function () { | |
if (i === 0) { | |
throw new Error("Execute too soon."); | |
} | |
return i; | |
}; | |
var obj = {}; | |
try { | |
Object.defineProperty(obj, "value", { get: getter }); | |
i = 1; | |
return obj.value === 1; | |
} catch (ex) { | |
return false; | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment