Full Code of mrdoob/stats.js for AI

master 71e88f65280f cached
13 files
18.0 KB
5.6k tokens
6 symbols
1 requests
Download .txt
Repository: mrdoob/stats.js
Branch: master
Commit: 71e88f65280f
Files: 13
Total size: 18.0 KB

Directory structure:
gitextract_lw73twef/

├── .github/
│   └── FUNDING.yml
├── .gitignore
├── LICENSE
├── README.md
├── bower.json
├── build/
│   ├── stats.js
│   └── stats.module.js
├── examples/
│   ├── basic.html
│   ├── custom.html
│   └── stress.html
├── package.json
├── rollup.config.js
└── src/
    └── Stats.js

================================================
FILE CONTENTS
================================================

================================================
FILE: .github/FUNDING.yml
================================================
github: [mrdoob]


================================================
FILE: .gitignore
================================================
node_modules


================================================
FILE: LICENSE
================================================
The MIT License

Copyright (c) 2009-2016 stats.js authors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.


================================================
FILE: README.md
================================================
stats.js
========

#### JavaScript Performance Monitor ####

This class provides a simple info box that will help you monitor your code performance.

* **FPS** Frames rendered in the last second. The higher the number the better.
* **MS** Milliseconds needed to render a frame. The lower the number the better.
* **MB** MBytes of allocated memory. (Run Chrome with `--enable-precise-memory-info`)
* **CUSTOM** User-defined panel support.


### Screenshots ###

![fps.png](https://raw.githubusercontent.com/mrdoob/stats.js/master/files/fps.png)
![ms.png](https://raw.githubusercontent.com/mrdoob/stats.js/master/files/ms.png)
![mb.png](https://raw.githubusercontent.com/mrdoob/stats.js/master/files/mb.png)
![custom.png](https://raw.githubusercontent.com/mrdoob/stats.js/master/files/custom.png)


### Installation ###
```bash
npm install stats.js
```

### Usage ###

```javascript
var stats = new Stats();
stats.showPanel( 1 ); // 0: fps, 1: ms, 2: mb, 3+: custom
document.body.appendChild( stats.dom );

function animate() {

	stats.begin();

	// monitored code goes here

	stats.end();

	requestAnimationFrame( animate );

}

requestAnimationFrame( animate );
```


### Bookmarklet ###

You can add this code to any page using the following bookmarklet:

```javascript
javascript:(function(){var script=document.createElement('script');script.onload=function(){var stats=new Stats();document.body.appendChild(stats.dom);requestAnimationFrame(function loop(){stats.update();requestAnimationFrame(loop)});};script.src='https://mrdoob.github.io/stats.js/build/stats.min.js';document.head.appendChild(script);})()
```


================================================
FILE: bower.json
================================================
{
	"name": "stats.js",
	"homepage": "https://github.com/mrdoob/stats.js",
	"description": "JavaScript Performance Monitor",
	"main": "build/stats.js",
	"keywords": [
		"stats",
		"statistics",
		"performance",
		"monitor",
		"fps"
	],
	"license": "MIT",
	"ignore": [
		"examples",
		"utils",
		"LICENSE"
	]
}


================================================
FILE: build/stats.js
================================================
(function (global, factory) {
	typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
	typeof define === 'function' && define.amd ? define(factory) :
	(global.Stats = factory());
}(this, (function () { 'use strict';

/**
 * @author mrdoob / http://mrdoob.com/
 */

var Stats = function () {

	var mode = 0;

	var container = document.createElement( 'div' );
	container.style.cssText = 'position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000';
	container.addEventListener( 'click', function ( event ) {

		event.preventDefault();
		showPanel( ++ mode % container.children.length );

	}, false );

	//

	function addPanel( panel ) {

		container.appendChild( panel.dom );
		return panel;

	}

	function showPanel( id ) {

		for ( var i = 0; i < container.children.length; i ++ ) {

			container.children[ i ].style.display = i === id ? 'block' : 'none';

		}

		mode = id;

	}

	//

	var beginTime = ( performance || Date ).now(), prevTime = beginTime, frames = 0;

	var fpsPanel = addPanel( new Stats.Panel( 'FPS', '#0ff', '#002' ) );
	var msPanel = addPanel( new Stats.Panel( 'MS', '#0f0', '#020' ) );

	if ( self.performance && self.performance.memory ) {

		var memPanel = addPanel( new Stats.Panel( 'MB', '#f08', '#201' ) );

	}

	showPanel( 0 );

	return {

		REVISION: 16,

		dom: container,

		addPanel: addPanel,
		showPanel: showPanel,

		begin: function () {

			beginTime = ( performance || Date ).now();

		},

		end: function () {

			frames ++;

			var time = ( performance || Date ).now();

			msPanel.update( time - beginTime, 200 );

			if ( time >= prevTime + 1000 ) {

				fpsPanel.update( ( frames * 1000 ) / ( time - prevTime ), 100 );

				prevTime = time;
				frames = 0;

				if ( memPanel ) {

					var memory = performance.memory;
					memPanel.update( memory.usedJSHeapSize / 1048576, memory.jsHeapSizeLimit / 1048576 );

				}

			}

			return time;

		},

		update: function () {

			beginTime = this.end();

		},

		// Backwards Compatibility

		domElement: container,
		setMode: showPanel

	};

};

Stats.Panel = function ( name, fg, bg ) {

	var min = Infinity, max = 0, round = Math.round;
	var PR = round( window.devicePixelRatio || 1 );

	var WIDTH = 80 * PR, HEIGHT = 48 * PR,
			TEXT_X = 3 * PR, TEXT_Y = 2 * PR,
			GRAPH_X = 3 * PR, GRAPH_Y = 15 * PR,
			GRAPH_WIDTH = 74 * PR, GRAPH_HEIGHT = 30 * PR;

	var canvas = document.createElement( 'canvas' );
	canvas.width = WIDTH;
	canvas.height = HEIGHT;
	canvas.style.cssText = 'width:80px;height:48px';

	var context = canvas.getContext( '2d' );
	context.font = 'bold ' + ( 9 * PR ) + 'px Helvetica,Arial,sans-serif';
	context.textBaseline = 'top';

	context.fillStyle = bg;
	context.fillRect( 0, 0, WIDTH, HEIGHT );

	context.fillStyle = fg;
	context.fillText( name, TEXT_X, TEXT_Y );
	context.fillRect( GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT );

	context.fillStyle = bg;
	context.globalAlpha = 0.9;
	context.fillRect( GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT );

	return {

		dom: canvas,

		update: function ( value, maxValue ) {

			min = Math.min( min, value );
			max = Math.max( max, value );

			context.fillStyle = bg;
			context.globalAlpha = 1;
			context.fillRect( 0, 0, WIDTH, GRAPH_Y );
			context.fillStyle = fg;
			context.fillText( round( value ) + ' ' + name + ' (' + round( min ) + '-' + round( max ) + ')', TEXT_X, TEXT_Y );

			context.drawImage( canvas, GRAPH_X + PR, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT, GRAPH_X, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT );

			context.fillRect( GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, GRAPH_HEIGHT );

			context.fillStyle = bg;
			context.globalAlpha = 0.9;
			context.fillRect( GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, round( ( 1 - ( value / maxValue ) ) * GRAPH_HEIGHT ) );

		}

	};

};

return Stats;

})));


================================================
FILE: build/stats.module.js
================================================
/**
 * @author mrdoob / http://mrdoob.com/
 */

var Stats = function () {

	var mode = 0;

	var container = document.createElement( 'div' );
	container.style.cssText = 'position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000';
	container.addEventListener( 'click', function ( event ) {

		event.preventDefault();
		showPanel( ++ mode % container.children.length );

	}, false );

	//

	function addPanel( panel ) {

		container.appendChild( panel.dom );
		return panel;

	}

	function showPanel( id ) {

		for ( var i = 0; i < container.children.length; i ++ ) {

			container.children[ i ].style.display = i === id ? 'block' : 'none';

		}

		mode = id;

	}

	//

	var beginTime = ( performance || Date ).now(), prevTime = beginTime, frames = 0;

	var fpsPanel = addPanel( new Stats.Panel( 'FPS', '#0ff', '#002' ) );
	var msPanel = addPanel( new Stats.Panel( 'MS', '#0f0', '#020' ) );

	if ( self.performance && self.performance.memory ) {

		var memPanel = addPanel( new Stats.Panel( 'MB', '#f08', '#201' ) );

	}

	showPanel( 0 );

	return {

		REVISION: 16,

		dom: container,

		addPanel: addPanel,
		showPanel: showPanel,

		begin: function () {

			beginTime = ( performance || Date ).now();

		},

		end: function () {

			frames ++;

			var time = ( performance || Date ).now();

			msPanel.update( time - beginTime, 200 );

			if ( time >= prevTime + 1000 ) {

				fpsPanel.update( ( frames * 1000 ) / ( time - prevTime ), 100 );

				prevTime = time;
				frames = 0;

				if ( memPanel ) {

					var memory = performance.memory;
					memPanel.update( memory.usedJSHeapSize / 1048576, memory.jsHeapSizeLimit / 1048576 );

				}

			}

			return time;

		},

		update: function () {

			beginTime = this.end();

		},

		// Backwards Compatibility

		domElement: container,
		setMode: showPanel

	};

};

Stats.Panel = function ( name, fg, bg ) {

	var min = Infinity, max = 0, round = Math.round;
	var PR = round( window.devicePixelRatio || 1 );

	var WIDTH = 80 * PR, HEIGHT = 48 * PR,
			TEXT_X = 3 * PR, TEXT_Y = 2 * PR,
			GRAPH_X = 3 * PR, GRAPH_Y = 15 * PR,
			GRAPH_WIDTH = 74 * PR, GRAPH_HEIGHT = 30 * PR;

	var canvas = document.createElement( 'canvas' );
	canvas.width = WIDTH;
	canvas.height = HEIGHT;
	canvas.style.cssText = 'width:80px;height:48px';

	var context = canvas.getContext( '2d' );
	context.font = 'bold ' + ( 9 * PR ) + 'px Helvetica,Arial,sans-serif';
	context.textBaseline = 'top';

	context.fillStyle = bg;
	context.fillRect( 0, 0, WIDTH, HEIGHT );

	context.fillStyle = fg;
	context.fillText( name, TEXT_X, TEXT_Y );
	context.fillRect( GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT );

	context.fillStyle = bg;
	context.globalAlpha = 0.9;
	context.fillRect( GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT );

	return {

		dom: canvas,

		update: function ( value, maxValue ) {

			min = Math.min( min, value );
			max = Math.max( max, value );

			context.fillStyle = bg;
			context.globalAlpha = 1;
			context.fillRect( 0, 0, WIDTH, GRAPH_Y );
			context.fillStyle = fg;
			context.fillText( round( value ) + ' ' + name + ' (' + round( min ) + '-' + round( max ) + ')', TEXT_X, TEXT_Y );

			context.drawImage( canvas, GRAPH_X + PR, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT, GRAPH_X, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT );

			context.fillRect( GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, GRAPH_HEIGHT );

			context.fillStyle = bg;
			context.globalAlpha = 0.9;
			context.fillRect( GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, round( ( 1 - ( value / maxValue ) ) * GRAPH_HEIGHT ) );

		}

	};

};

export default Stats;


================================================
FILE: examples/basic.html
================================================
<!DOCTYPE html>
<html>
	<head>
		<title>stats.js - basic example</title>
		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
		<style>
			body {
				margin: 0px;
				overflow: hidden;
			}
		</style>
	</head>
	<body>
		<script src="../build/stats.min.js"></script>
		<script>

			var stats = new Stats();
			stats.showPanel( 1 );
			document.body.appendChild( stats.dom );

			var canvas = document.createElement( 'canvas' );
			canvas.width = 512;
			canvas.height = 512;
			document.body.appendChild( canvas );

			var context = canvas.getContext( '2d' );
			context.fillStyle = 'rgba(127,0,255,0.05)';

			function animate() {

				var time = performance.now() / 1000;

				context.clearRect( 0, 0, 512, 512 );

				stats.begin();

				for ( var i = 0; i < 2000; i ++ ) {

					var x = Math.cos( time + i * 0.01 ) * 196 + 256;
					var y = Math.sin( time + i * 0.01234 ) * 196 + 256;

					context.beginPath();
					context.arc( x, y, 10, 0, Math.PI * 2, true );
					context.fill();

				}

				stats.end();

				requestAnimationFrame( animate );

			}

			animate();

		</script>
	</body>
</html>


================================================
FILE: examples/custom.html
================================================
<!DOCTYPE html>
<html>
	<head>
		<title>stats.js - custom panel example</title>
		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
		<style>
			body {
				margin: 0px;
				overflow: hidden;
			}
		</style>
	</head>
	<body>
		<script src="../build/stats.min.js"></script>
		<script>

			var stats = new Stats();
			var xPanel = stats.addPanel( new Stats.Panel( 'x', '#ff8', '#221' ) );
			var yPanel = stats.addPanel( new Stats.Panel( 'y', '#f8f', '#212' ) );
			stats.showPanel( 3 );
			document.body.appendChild( stats.dom );

			var canvas = document.createElement( 'canvas' );
			canvas.width = 512;
			canvas.height = 512;
			document.body.appendChild( canvas );

			var context = canvas.getContext( '2d' );
			context.fillStyle = 'rgba(127,0,255,0.05)';

			var test = [];

			function animate() {

				var time = performance.now() / 1000;

				context.clearRect( 0, 0, 512, 512 );

				stats.begin();

				for ( var i = 0; i < 2000; i ++ ) {

					var x = Math.cos( time + i * 0.01 ) * 196 + 256;
					var y = Math.sin( time + i * 0.01234 ) * 196 + 256;

					context.beginPath();
					context.arc( x, y, 10, 0, Math.PI * 2, true );
					context.fill();

				}

				stats.end();

				xPanel.update( x, 460 );
				yPanel.update( y, 460 );

				requestAnimationFrame( animate );

			}

			animate();

		</script>
	</body>
</html>


================================================
FILE: examples/stress.html
================================================
<!DOCTYPE html>
<html>
	<head>
		<title>stats.js - stress test</title>
		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
		<style>
			body {
				margin: 0px;
				overflow: hidden;
			}
		</style>
	</head>
	<body>
		<script src="../build/stats.min.js"></script>
		<script>

			var array = [];

			for ( var i = 0; i < 500; i ++ ) {

				var stats = new Stats();
				stats.dom.style.position = 'relative';
				stats.dom.style.float = 'left';
				document.body.appendChild( stats.dom );

				array.push( stats );

			}

			function animate() {

				for ( var i = 0; i < array.length; i ++ ) {

					var stats = array[ i ];
					stats.update();

				}

				requestAnimationFrame( animate );

			}

			animate();

		</script>
	</body>
</html>


================================================
FILE: package.json
================================================
{
  "name": "stats.js",
  "version": "0.17.0",
  "description": "JavaScript Performance Monitor",
  "main": "build/stats.js",
  "module": "build/stats.module.js",
  "repository": "mrdoob/stats.js",
  "directories": {
    "example": "examples"
  },
  "files": [
    "build",
    "src"
  ],
  "scripts": {
    "build": "rollup -c",
    "build-closure": "rollup -c && google-closure-compiler --language_in=ECMASCRIPT5_STRICT --js build/stats.js --js_output_file build/stats.min.js",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [
    "performance",
    "fps",
    "stats"
  ],
  "author": "mrdoob",
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/mrdoob/stats.js/issues"
  },
  "homepage": "https://github.com/mrdoob/stats.js",
  "devDependencies": {
    "rollup": "^2.3.2",
    "google-closure-compiler": "20200224.0.0"
  }
}


================================================
FILE: rollup.config.js
================================================
export default {
	input: 'src/Stats.js',
	output: [
		{
			format: 'umd',
			name: 'Stats',
			file: 'build/stats.js',
			indent: '\t'
		},
		{
			format: 'es',
			name: 'Stats',
			file: 'build/stats.module.js',
			indent: '\t'
		}
	]
};


================================================
FILE: src/Stats.js
================================================
/**
 * @author mrdoob / http://mrdoob.com/
 */

var Stats = function () {

	var mode = 0;

	var container = document.createElement( 'div' );
	container.style.cssText = 'position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000';
	container.addEventListener( 'click', function ( event ) {

		event.preventDefault();
		showPanel( ++ mode % container.children.length );

	}, false );

	//

	function addPanel( panel ) {

		container.appendChild( panel.dom );
		return panel;

	}

	function showPanel( id ) {

		for ( var i = 0; i < container.children.length; i ++ ) {

			container.children[ i ].style.display = i === id ? 'block' : 'none';

		}

		mode = id;

	}

	//

	var beginTime = ( performance || Date ).now(), prevTime = beginTime, frames = 0;

	var fpsPanel = addPanel( new Stats.Panel( 'FPS', '#0ff', '#002' ) );
	var msPanel = addPanel( new Stats.Panel( 'MS', '#0f0', '#020' ) );

	if ( self.performance && self.performance.memory ) {

		var memPanel = addPanel( new Stats.Panel( 'MB', '#f08', '#201' ) );

	}

	showPanel( 0 );

	return {

		REVISION: 16,

		dom: container,

		addPanel: addPanel,
		showPanel: showPanel,

		begin: function () {

			beginTime = ( performance || Date ).now();

		},

		end: function () {

			frames ++;

			var time = ( performance || Date ).now();

			msPanel.update( time - beginTime, 200 );

			if ( time >= prevTime + 1000 ) {

				fpsPanel.update( ( frames * 1000 ) / ( time - prevTime ), 100 );

				prevTime = time;
				frames = 0;

				if ( memPanel ) {

					var memory = performance.memory;
					memPanel.update( memory.usedJSHeapSize / 1048576, memory.jsHeapSizeLimit / 1048576 );

				}

			}

			return time;

		},

		update: function () {

			beginTime = this.end();

		},

		// Backwards Compatibility

		domElement: container,
		setMode: showPanel

	};

};

Stats.Panel = function ( name, fg, bg ) {

	var min = Infinity, max = 0, round = Math.round;
	var PR = round( window.devicePixelRatio || 1 );

	var WIDTH = 80 * PR, HEIGHT = 48 * PR,
			TEXT_X = 3 * PR, TEXT_Y = 2 * PR,
			GRAPH_X = 3 * PR, GRAPH_Y = 15 * PR,
			GRAPH_WIDTH = 74 * PR, GRAPH_HEIGHT = 30 * PR;

	var canvas = document.createElement( 'canvas' );
	canvas.width = WIDTH;
	canvas.height = HEIGHT;
	canvas.style.cssText = 'width:80px;height:48px';

	var context = canvas.getContext( '2d' );
	context.font = 'bold ' + ( 9 * PR ) + 'px Helvetica,Arial,sans-serif';
	context.textBaseline = 'top';

	context.fillStyle = bg;
	context.fillRect( 0, 0, WIDTH, HEIGHT );

	context.fillStyle = fg;
	context.fillText( name, TEXT_X, TEXT_Y );
	context.fillRect( GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT );

	context.fillStyle = bg;
	context.globalAlpha = 0.9;
	context.fillRect( GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT );

	return {

		dom: canvas,

		update: function ( value, maxValue ) {

			min = Math.min( min, value );
			max = Math.max( max, value );

			context.fillStyle = bg;
			context.globalAlpha = 1;
			context.fillRect( 0, 0, WIDTH, GRAPH_Y );
			context.fillStyle = fg;
			context.fillText( round( value ) + ' ' + name + ' (' + round( min ) + '-' + round( max ) + ')', TEXT_X, TEXT_Y );

			context.drawImage( canvas, GRAPH_X + PR, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT, GRAPH_X, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT );

			context.fillRect( GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, GRAPH_HEIGHT );

			context.fillStyle = bg;
			context.globalAlpha = 0.9;
			context.fillRect( GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, round( ( 1 - ( value / maxValue ) ) * GRAPH_HEIGHT ) );

		}

	};

};

export { Stats as default };
Download .txt
gitextract_lw73twef/

├── .github/
│   └── FUNDING.yml
├── .gitignore
├── LICENSE
├── README.md
├── bower.json
├── build/
│   ├── stats.js
│   └── stats.module.js
├── examples/
│   ├── basic.html
│   ├── custom.html
│   └── stress.html
├── package.json
├── rollup.config.js
└── src/
    └── Stats.js
Download .txt
SYMBOL INDEX (6 symbols across 3 files)

FILE: build/stats.js
  function addPanel (line 26) | function addPanel( panel ) {
  function showPanel (line 33) | function showPanel( id ) {

FILE: build/stats.module.js
  function addPanel (line 20) | function addPanel( panel ) {
  function showPanel (line 27) | function showPanel( id ) {

FILE: src/Stats.js
  function addPanel (line 20) | function addPanel( panel ) {
  function showPanel (line 27) | function showPanel( id ) {
Condensed preview — 13 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (21K chars).
[
  {
    "path": ".github/FUNDING.yml",
    "chars": 17,
    "preview": "github: [mrdoob]\n"
  },
  {
    "path": ".gitignore",
    "chars": 13,
    "preview": "node_modules\n"
  },
  {
    "path": "LICENSE",
    "chars": 1082,
    "preview": "The MIT License\n\nCopyright (c) 2009-2016 stats.js authors\n\nPermission is hereby granted, free of charge, to any person o"
  },
  {
    "path": "README.md",
    "chars": 1616,
    "preview": "stats.js\n========\n\n#### JavaScript Performance Monitor ####\n\nThis class provides a simple info box that will help you mo"
  },
  {
    "path": "bower.json",
    "chars": 309,
    "preview": "{\n\t\"name\": \"stats.js\",\n\t\"homepage\": \"https://github.com/mrdoob/stats.js\",\n\t\"description\": \"JavaScript Performance Monito"
  },
  {
    "path": "build/stats.js",
    "chars": 3818,
    "preview": "(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory()"
  },
  {
    "path": "build/stats.module.js",
    "chars": 3565,
    "preview": "/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nvar Stats = function () {\n\n\tvar mode = 0;\n\n\tvar container = document.cre"
  },
  {
    "path": "examples/basic.html",
    "chars": 1160,
    "preview": "<!DOCTYPE html>\n<html>\n\t<head>\n\t\t<title>stats.js - basic example</title>\n\t\t<meta name=\"viewport\" content=\"width=device-w"
  },
  {
    "path": "examples/custom.html",
    "chars": 1393,
    "preview": "<!DOCTYPE html>\n<html>\n\t<head>\n\t\t<title>stats.js - custom panel example</title>\n\t\t<meta name=\"viewport\" content=\"width=d"
  },
  {
    "path": "examples/stress.html",
    "chars": 798,
    "preview": "<!DOCTYPE html>\n<html>\n\t<head>\n\t\t<title>stats.js - stress test</title>\n\t\t<meta name=\"viewport\" content=\"width=device-wid"
  },
  {
    "path": "package.json",
    "chars": 871,
    "preview": "{\n  \"name\": \"stats.js\",\n  \"version\": \"0.17.0\",\n  \"description\": \"JavaScript Performance Monitor\",\n  \"main\": \"build/stats"
  },
  {
    "path": "rollup.config.js",
    "chars": 239,
    "preview": "export default {\n\tinput: 'src/Stats.js',\n\toutput: [\n\t\t{\n\t\t\tformat: 'umd',\n\t\t\tname: 'Stats',\n\t\t\tfile: 'build/stats.js',\n\t"
  },
  {
    "path": "src/Stats.js",
    "chars": 3572,
    "preview": "/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nvar Stats = function () {\n\n\tvar mode = 0;\n\n\tvar container = document.cre"
  }
]

About this extraction

This page contains the full source code of the mrdoob/stats.js GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 13 files (18.0 KB), approximately 5.6k tokens, and a symbol index with 6 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!