Code Monkey home page Code Monkey logo

event-logger's Introduction

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')

// Shared plugin: Install on the prototype:
Hypergrid.prototype.installPlugins(eventLoggerPlugin);
// The plugin is now available to all existing and new grid instances

// Instance plugin: Install on the instance (available to this instance only):
var grid = new Hypergrid;
grid.installPlugins(eventLoggerPlugin);

// or in one step:
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(); // event signals are now being logged (to the console by default)
...
myGrid.logStop(); // events are no longer logged

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.

event-logger's People

Contributors

joneit avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.