difenduandada
2024-12-31 34abe6963b344c882358274957f4b992456fee40
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
if (!Math.sign) {
    Math.sign = function (x) {
        x = +x; // convert to a number
        if (x === 0 || isNaN(x)) {
            return x;
        }
        return x > 0 ? 1 : -1;
    };
}
 
if (!Number.isInteger) {
    Number.isInteger = function (value) {
        return typeof value === 'number' && isFinite(value) && Math.floor(value) === value;
    };
}
 
if (CC_JSB || CC_RUNTIME || !console.time) {
    var Timer = window.performance || Date;
    var _timerTable = Object.create(null);
    console.time = function (label) {
        _timerTable[label] = Timer.now();
    };
    console.timeEnd = function (label) {
        var startTime = _timerTable[label];
        var duration = Timer.now() - startTime;
        console.log(`${label}: ${duration}ms`);
    };
}