andreypopp / autobind-decorator

Decorator to automatically bind methods to class instances

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Assigning key to a function using Object.defineProperty fails in IE11

stsvilik opened this issue · comments

Line 87 in index.js causes stack overflow in IE11, my take is that placing Object.defineProperty inside a get method causes it to be re-triggered by Object.defineProperty. Easy fix is not to use Object.defineProperty and instead use old fashioned key assignment a.k.a

this[key] = boundFn;

It looks like you're making it writable and configurable, so Object.defineProperty might be an overkill for this.

Looks like what I suggested only fixes IE, but breaks Chrome. Well something for you to figure out :)