Socket
Socket
Sign inDemoInstall

crossvent

Package Overview
Dependencies
1
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.3.2 to 1.4.0

4

CHANGELOG.md

@@ -0,1 +1,5 @@

# v1.4.0 Fabricator
- Added optional custom event model for `.fabricate`
# v1.3.2 Ice Bug

@@ -2,0 +6,0 @@

7

package.json
{
"name": "crossvent",
"description": "Cross-platform browser event handling",
"version": "1.3.2",
"version": "1.4.0",
"homepage": "https://github.com/bevacqua/crossvent",
"author": {
"email": "hello@bevacqua.io",
"name": "Nicolas Bevacqua",
"email": "hello@bevacqua.io",
"url": "http://bevacqua.io"

@@ -33,3 +33,6 @@ },

"vinyl-source-stream": "^0.1.1"
},
"dependencies": {
"custom-event": "1.0.0"
}
}

@@ -48,12 +48,12 @@ # crossvent

### `crossvent.fabricate(el, type)`
### `crossvent.fabricate(el, type, model?)`
Creates a synthetic event of type `type` and dispatches it on `el`.
Creates a synthetic custom event of type `type` and dispatches it on `el`. You can provide a custom `model` which will be accessible as `e.detail`.
```js
crossvent.add(document.body, 'sugar', sugary);
crossvent.fabricate(document.body, 'sugar');
crossvent.fabricate(document.body, 'sugar', { onTop: true });
function sugary (e) {
console.log('synthetic sugar event raised');
console.log('synthetic sugar' + e.detail.onTop ? ' on top' : '');
}

@@ -60,0 +60,0 @@ ```

'use strict';
var customEvent = require('custom-event');
var doc = document;

@@ -29,10 +30,7 @@ var addEvent = addEventEasy;

function fabricateEvent (el, type) {
var e;
if (doc.createEvent) {
e = doc.createEvent('Event');
e.initEvent(type, true, true);
function fabricateEvent (el, type, model) {
var e = new customEvent(type, { detail: model });
if (el.dispatchEvent) {
el.dispatchEvent(e);
} else if (doc.createEventObject) {
e = doc.createEventObject();
} else {
el.fireEvent('on' + type, e);

@@ -39,0 +37,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc