javascript - Error when referencing requestanimationframe from object -
i'm trying call mozrequestanimationframe in firefox, keep getting error. here code:
var obj={ animframe:mozrequestanimationframe } var animf=mozrequestanimationframe; function a(){ console.log('a called'); } animf(a); obj.animframe(a); the error occurs obj.animframe(a); error message of:
illegal operation on wrappednative prototype object
i found thread on so: requestanimationframe keyword , figured maybe requestanimationframe didn't have right "this" context, tried
obj.animframe(a).bind(window); but still got same error message. why error occurring?
i dont know reason why need save pointer requestanimationframe (mozrequestanimationframe) object, try next code avoid error:
var obj={ animframe:mozrequestanimationframe.bind(window) } function a(){ console.log('a called'); } obj.animframe(a);
Comments
Post a Comment