Skip to content

Commit

Permalink
If Object.defineProperty doesn't exist fallback to just using grabbin…
Browse files Browse the repository at this point in the history
…g the property.
  • Loading branch information
Friss committed Nov 6, 2014
1 parent 8f77984 commit de29aa9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
15 changes: 9 additions & 6 deletions pace.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -289,12 +289,15 @@ extendNative = (to, from) ->
for key of from::
try
if not to[key]? and typeof from[key] isnt 'function'
Object.defineProperty?(to, key, {
get: ->
return from[key];
,
configurable: true,
enumerable: true })
if typeof Object.defineProperty is 'function'
Object.defineProperty(to, key, {
get: ->
return from[key];
,
configurable: true,
enumerable: true })
else
to[key] = from[key]
catch e

ignoreStack = []
Expand Down
18 changes: 11 additions & 7 deletions pace.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit de29aa9

Please sign in to comment.