Skip to content

Commit f2ccc1a

Browse files
committed
r7
Replaced new Date().getTimer() with Date.now() Beautified usage code
1 parent ced16d5 commit f2ccc1a

File tree

4 files changed

+25
-19
lines changed

4 files changed

+25
-19
lines changed

README.md

+16-10
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,22 @@ This class provides a simple info box that will help you monitor your code perfo
2020

2121
### Usage ###
2222

23-
var stats = new Stats();
23+
```javascript
24+
var stats = new Stats();
2425

25-
// Align top-left
26-
stats.domElement.style.position = 'absolute';
27-
stats.domElement.style.left = '0px';
28-
stats.domElement.style.top = '0px';
26+
// Align top-left
27+
stats.domElement.style.position = 'absolute';
28+
stats.domElement.style.left = '0px';
29+
stats.domElement.style.top = '0px';
2930

30-
parentElement.appendChild( stats.domElement );
31+
parentElement.appendChild( stats.domElement );
3132

32-
setInterval( function () {
33+
setInterval( function () {
3334

34-
stats.update();
35-
36-
}, 1000 / 60 );
35+
stats.update();
3736

37+
}, 1000 / 60 );
38+
```
3839

3940
### Enable MB ###
4041

@@ -55,6 +56,11 @@ Albeit theorically not as accurate the widget can also be easily inserted to **a
5556

5657
### Change Log ###
5758

59+
2011 10 13 - **r7** (4.083 KB, gzip: 1.377 KB)
60+
61+
* Replaced `new Date().getTime()` with `Date.now()`.
62+
63+
5864
2011 05 28 - **r6** (4.103 KB, gzip: 1.384 KB)
5965

6066
* Updated check for memory accesible browsers.

build/Stats.js

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Stats.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
var Stats = function () {
2222

2323
var _mode = 0, _modesCount = 2, _container,
24-
_frames = 0, _time = new Date().getTime(), _timeLastFrame = _time, _timeLastSecond = _time,
24+
_frames = 0, _time = Date.now(), _timeLastFrame = _time, _timeLastSecond = _time,
2525
_fps = 0, _fpsMin = 1000, _fpsMax = 0, _fpsDiv, _fpsText, _fpsCanvas, _fpsContext, _fpsImageData,
2626
_ms = 0, _msMin = 1000, _msMax = 0, _msDiv, _msText, _msCanvas, _msContext, _msImageData,
2727
_mb = 0, _mbMin = 1000, _mbMax = 0, _mbDiv, _mbText, _mbCanvas, _mbContext, _mbImageData,
@@ -226,7 +226,7 @@ var Stats = function () {
226226

227227
_frames ++;
228228

229-
_time = new Date().getTime();
229+
_time = Date.now();
230230

231231
_ms = _time - _timeLastFrame;
232232
_msMin = Math.min( _msMin, _ms );

utils/builder.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import sys
22
import os
33

4-
rev = 6;
4+
rev = 7;
55
output = '../build/Stats.js';
66
string = "// stats.js r" + str(rev) + " - http://github.com/mrdoob/stats.js\n";
77

0 commit comments

Comments
 (0)