gerry

Gerry,a tiny module for collecting and logging events.

Usage no npm install needed!

<script type="module">
  import gerry from 'https://cdn.skypack.dev/gerry';
</script>

README

Gerry

NPM VERSION CODACY BADGE CODECLIMATE-TEST-COVERAGE LICENSE

NODE VERSION TRAVIS CI BUILD BUILD STATUS DEVDEPENDENCY STATUS

NPM MONTHLY NPM YEARLY

NPM GRAPH

Gerry, a tiny module for collecting and logging events.

Install

$ npm install gerry [-g]

require:

var Gerry  = require( 'gerry' );

Run Tests

$ cd gerry/
$ npm test

Constructor

Arguments within [ ] are optional.

Gerry( EventEmitter emt [, Array evt_names [, Function logger ] ] )
// or
new Gerry( EventEmitter emt [, Array evt_names [, Function logger ] ] )

Properties


/*
 * Current emitter to listen.
 */
Gerry.emt : EventEmitter

/*
 * List of event names to log/save.
 */
Gerry.events : Array

/*
 * Array of event listeners.
 */
Gerry.listeners : Array

/*
 * The logger function, for default it outputs to console.
 */
Gerry.lfn : Function

/*
 * An obj/hash containing The list of collected event names and arguments.
 * { events : [ .. ], args : [ .. ] }
 */
Gerry.collected : Object

Methods

Arguments within [ ] are optional.

/*
 * Enable event logging by adding all events listeners.
 */
Gerry#enable = function ( [ Boolean collect_events [, Function logger ] ] ) : Gerry

/*
 * Disable event logging by removing all events listeners.
 */
Gerry#disable = function ( [ Function logger ] ) : Gerry

/*
 * Update/push event names, a name is added if not already exists in the list.
 */
Gerry#push = function ( [ Boolean collect_events [, Array evt_names ] ] ) : Number

/*
 * Return the current list length.
 */
Gerry#size = function () : Number

/*
 * Flush event names and listeners.
 */
Gerry#flush = function () : Gerry

MIT License

Copyright (c) 2014-present < Guglielmo Ferri : 44gatti@gmail.com >

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.