hook Date实现 时间固定
代码是从大佬的v_jstool 里扣出来的```
//ftime 为固定的时间
const ftime = 123
Date = function (_Date) {
var bind = Function.bind;
var unbind = bind.bind(bind);
function instantiate(constructor, args) {
return new (unbind(constructor, null).apply(null, args));
}
var names = Object.getOwnPropertyNames(_Date);
for (var i = 0; i < names.length; i++) {
if (names in Date)
continue;
var desc = Object.getOwnPropertyDescriptor(_Date, names);
Object.defineProperty(Date, names, desc);
}
function Date() {
var date = instantiate(_Date, ); // 固定返回某一个时间点
return date;
}
Date.prototype = _Date.prototype
return Date
}(Date);
Date.now = function now() { return ftime }
``` 哥哥用魔法固定住时间,是想长生不老的么
页:
[1]