Hypegrid starlog plug-in
Summary
Adds an event logger to your Hypergrid application for debugging purposes.
Synopsis
1. Installing the plugin
var Hypergrid = require('fin-hypergrid');
var eventLoggerPlugin = require('fin-hypergrid-event-logger')
Hypergrid.prototype.installPlugins(eventLoggerPlugin);
var grid = new Hypergrid;
grid.installPlugins(eventLoggerPlugin);
var grid = new Hypergrid({ plugins: eventLoggerPlugin });
NOTE: In actual practice you would want to wait for the DOM to finish loading before instantiating a grid.
2. Starting and stopping event logging
myGrid.logStart();
...
myGrid.logStop();
Description
Adds logStart()
and logStop()
methods to Hypergrid.prototype
similar to the starlog
methods of the same names except that:
- The
StarLog
constructor is called automatically when this logStart
is called with a starlog options object. - This
logStart
adds some default option values directing starlog to:
- Search grid instance for event strings
- Blacklist the
fin-tick
event string - Attach logging listeners to the canvas element
The default search pattern looks for calls to dispatchEvent
and CustomEvent
.
The search currently yields 29 events.
Of these, 18 have custom listeners that log specific information; the rest use the default listener that logs only the event name.
Installation options
methodPrefix
is the only installation option.
It overrides the default method name prefix (log
).
Hypergrid.prototype.installPlugins([eventLoggerPlugin, 'starlog_']);
The above installs the methods starlog_start()
and starlog_stop()
instead of the default logStart()
and logStop()
.
Loading the plug-in
See the Loading Modules wiki.