xStats.prototype.height
xStats.prototype.locked
xStats.prototype.mode
xStats.prototype.padding
xStats.prototype.sampleRate
xStats.prototype.width
xStats.prototype.addListener
xStats.prototype.emit
xStats.prototype.on
xStats.prototype.removeAllListeners
xStats.prototype.removeListener
The xStats constructor.
[options={}]
(Object): Options object.
// basic usage (the `new` operator is optional)
var stats = new xStats;
// or using options
var stats = new xStats({
'mode': 'ms',
'height': 130,
'width':200,
'padding':10,
'locked': false,
'fps': {
'bg': '#330000',
'fg': '#cc6600'
},
'ms': {
'bg': '#000033',
'fg': '#3366ff'
},
'mem': {
'bg': '#000033',
'fg': '#660099'
}
});
// insert into document
document.body.appendChild(stats.element);
(Array): An array of xStat instances.
(Number): The height of the chart (px).
(Boolean): A flag to indicate if the chart is locked at its current display mode.
(String): The charts current display mode (fps, ms, mem).
(Number): The inner padding of the chart that doesn't affect dimensions (px).
(Number): The rate at which the "sample" event is emitted (secs).
(Number): The width of the chart (px).
Registers a single listener for the specified event type(s).
type
(String): The event type.listener
(Function): The function called when the event occurs.
(Object): The xStats instance.
// register a listener for an event type
xs.addListener('sample', listener);
// register a listener for multiple event types
xs.addListener('start sample', listener);
Executes all registered listeners of the specified event type.
type
(String|Object): The event type or object.
(Boolean): Returns true
if all listeners were executed, else false
.
Alias of xStats#addListener
.
Unregisters all listeners or those for the specified event type(s).
type
(String): The event type.
(Object): The xStats instance.
// unregister all listeners
xs.removeAllListeners();
// unregister all listeners for an event type
xs.removeAllListeners('sample');
// unregister all listeners for multiple event types
xs.removeAllListeners('start sample complete');
Unregisters a single listener for the specified event type(s).
type
(String): The event type.listener
(Function): The function to unregister.
(Object): The xStats instance.
// unregister a listener for an event type
xs.removeListener('sample', listener);
// unregister a listener for multiple event types
xs.removeListener('start sample', listener);
(Object): The "frames per second" display mode options object.
(String): The background color of the chart for the display mode.
(String): The foreground color of the chart for the display mode.
(Object): The "memory" display mode options object.
(String): The background color of the chart for the display mode.
(String): The foreground color of the chart for the display mode.
(Object): The "millisecond" display mode options object.
(String): The background color of the chart for the display mode.
(String): The foreground color of the chart for the display mode.
The Event constructor.
type
(String|Object): The event type.
(String): The event type.