【发布时间】:2013-11-07 18:11:53
【问题描述】:
代码
var x = {};
x.request = window.requestAnimationFrame;
function step(timestamp) {
console.log('sth');
}
x.request(step);
返回:
NS_ERROR_XPC_BAD_OP_ON_WN_PROTO:对 WrappedNative 的非法操作 原型对象
它应该使 x.request 与 window.requestAnimationFrame 一样工作。 我需要它,因为我想做类似的东西:
x.request = window.requestAnimationFrame
||
window.webkitRequestAnimationFrame
||
window.mozRequestAnimationFrame;
【问题讨论】:
-
An article 来自 Paul Irish,带有 polyfill
-
是的,但是将它分配给窗口对象并不是我一直在寻找的。span>
标签: javascript window requestanimationframe