fin-hypergrid-event-logger
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -15,2 +15,4 @@ 'use strict'; | ||
options = Object.assign({}, options); | ||
// search grid object for "Event('yada-yada'" or "Event.call(this, 'yada-yada'" | ||
options.select = options.select || this; | ||
@@ -20,3 +22,7 @@ options.pattern = options.pattern || /Event(\.call\(this, |\()'(fin-[a-z-]+)'/; | ||
var black = ['fin-tick', 'mousemove']; | ||
// mix options.listenerDictionary on top of some custom listeners | ||
options.listenerDictionary = Object.assign({}, require('./custom-listeners'), options.listenerDictionary); | ||
// mix fin-tick on top of options.match.greylist.black | ||
var black = ['fin-tick']; | ||
options.match = options.match || {}; | ||
@@ -23,0 +29,0 @@ options.match.greylist = options.match.greylist || {}; |
{ | ||
"name": "fin-hypergrid-event-logger", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Hypegrid starlog plug-in", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -8,2 +8,3 @@ Hypegrid starlog plug-in | ||
### Synopsis | ||
#### 1. Installing the plugin | ||
@@ -14,5 +15,5 @@ ```js | ||
// Shared plugin: Install on the prototype (available to all grid instances): | ||
// Shared plugin: Install on the prototype: | ||
Hypergrid.prototype.installPlugins(eventLoggerPlugin); | ||
var grid = new Hypergrid; | ||
// The plugin is now available to all existing and new grid instances | ||
@@ -27,3 +28,3 @@ // Instance plugin: Install on the instance (available to this instance only): | ||
``` | ||
Either way, this plug-in installs itself into `Hypergrid.prototype` and therefore is then available to all instances. | ||
> NOTE: In actual practice you would want to wait for the DOM to finish loading before instantiating a grid. | ||
@@ -37,4 +38,2 @@ #### 2. Starting and stopping event logging | ||
> NOTE: In actual practice you would want to wait for the DOM to finish loading before instantiating a grid. | ||
### Description | ||
@@ -46,3 +45,3 @@ | ||
* Search grid instance for event strings found in first param of calls to `addEventListener` | ||
* Blacklist the `fin-tick` and `fin-mousemove` event strings | ||
* Blacklist the `fin-tick` event string | ||
* Attach logging listeners to the canvas element | ||
@@ -60,47 +59,2 @@ | ||
The plug-in can be built into your app and loaded with it, or can be loaded separately by the client: | ||
* **CommonJS modules** are merged at build time into a single file which is loaded at run time with a single `<script>` tag. | ||
* **Client modules** are individual files that are loaded at run time | ||
#### CommonJS modules | ||
At build time Browserify or webpack converts `index.js` and any other files it "requires" into a single build file, loaded by the client with a single `<script>` tag: | ||
```html | ||
<script src='my-build.js'></script> | ||
``` | ||
#### Client modules | ||
If not using Browserify or webpack, the client loads each "required" module separately: | ||
`index.html`: | ||
```html | ||
<script src='https://fin-hypergrid.github.io/core/2.0.2/build/fin-hypergrid.min.js'></script> | ||
<script src='https://fin-hypergrid.github.io/event-logger/1.0.0/build/event-logger.min.js'></script> | ||
<script src='main.js'></script> | ||
``` | ||
In the above: | ||
1. Hypergrid loads itself synchronously into the `fin.Hypergrid` global. | ||
2. Other files then load themselves (synchronously or asynchronously) into members of the `fin.Hypergrid.modules` namespace. | ||
The file `main.js` is a "wrapped" version of `index.js`: | ||
```js | ||
window.onload = (function(require){ | ||
/* index.js contents goes here */ | ||
}).bind(null, fin.Hypergrid.require); | ||
``` | ||
A gulp or grunt watch task can be set up to do the wrapping. | ||
Alternatively, you can avoid wrapping by using `Hypergrid.require()` isntead of `require()`. The advantage of wrapping is that index.js remains a CommonJS module, which is nice if your intention to to eventually migrate to BBrowserify or webpack usage. | ||
### Hypergrid Client Modules | ||
While the above guidelines are sufficient, a _Hypergrid Client Module_ has a wrapper that does both of the following: | ||
* Inserts the module into `Hypergrid.modules` | ||
* Supports `module`, `moudle.exports`, `exports`, and `require` within the module | ||
The following utilities help wrap up modules as Hypergrid Client Modules: | ||
* [`fin-hypergrid-client-module-wrapper`](https://github.com/fin-hypergrid/client-module-wrapper) defines a succinct little wrapper that in addition to making `require()` available (similar to the simple wrapper shown above), also makes `module`, `module.exports`, and `exports` available and also transparently assigns `fin.Hypergrid.modules[modulename] = module.exports` for you. | ||
* [`fin-hypergrid-client-module-maker`](https://github.com/fin-hypergrid/client-module-maker) defines a standard gulp task for wrapping your code. It also defines standard `lint` and `test` tasks. | ||
See also the [Client Modules](https://github.com/fin-hypergrid/core/wiki/Client-Modules) wiki that describes the concepts in detail. | ||
See the [_Loading Modules_](https://github.com/fin-hypergrid/core/wiki/Loading-Modules) wiki. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4
102
6552
54