Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

Commit

Permalink
v2.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Steffan committed Mar 31, 2018
1 parent a0ec018 commit 8ad21a1
Show file tree
Hide file tree
Showing 6 changed files with 228 additions and 219 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The plugin for [Vue.js](http://vuejs.org) provides a declarative way to bind eve

- Supports event priorities and [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) based asynchronous events
- Supports latest Firefox, Chrome, Safari, Opera and IE9+
- Supports Vue 2.0 & Vue 1.0
- Supports Vue 2.0
- Compact size 2KB

## Installation
Expand All @@ -17,9 +17,9 @@ $ npm install vue-event-manager
```

### CDN
Available on [jsdelivr](https://cdn.jsdelivr.net/npm/[email protected].0) or [unpkg](https://unpkg.com/[email protected].0).
Available on [jsdelivr](https://cdn.jsdelivr.net/npm/[email protected].1) or [unpkg](https://unpkg.com/[email protected].1).
```html
<script src="https://cdn.jsdelivr.net/npm/[email protected].0"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected].1"></script>
```

## Example
Expand Down
59 changes: 31 additions & 28 deletions dist/vue-event-manager.common.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* vue-event-manager v2.0.0
* vue-event-manager v2.0.1
* https://github.com/pagekit/vue-event-manager
* Released under the MIT License.
*/
Expand All @@ -26,45 +26,48 @@ function forEach(collection, callback) {
});
}

/**
* Array.findIndex() polyfill.
*/
if (!Array.prototype.findIndex) {
function array(array) {
if ( array === void 0 ) array = [];

// eslint-disable-next-line
Object.defineProperty(Array.prototype, 'findIndex', {

value: function value(predicate) {
if (!array.findIndex) {
array.findIndex = findIndex;
}

if (this == null) {
throw new TypeError('"this" is null or not defined');
}
return array;
}

if (typeof predicate !== 'function') {
throw new TypeError('predicate must be a function');
}
/**
* Array.findIndex() polyfill.
*/
function findIndex(predicate) {

var o = Object(this);
var len = o.length >>> 0;
var thisArg = arguments[1];
if (this == null) {
throw new TypeError('"this" is null or not defined');
}

var k = 0;
if (typeof predicate !== 'function') {
throw new TypeError('predicate must be a function');
}

while (k < len) {
var o = Object(this);
var len = o.length >>> 0;
var thisArg = arguments[1];

var kValue = o[k];
var k = 0;

if (predicate.call(thisArg, kValue, k, o)) {
return k;
}
while (k < len) {

k++;
}
var kValue = o[k];

return -1;
if (predicate.call(thisArg, kValue, k, o)) {
return k;
}

});
k++;
}

return -1;
}

/**
Expand All @@ -80,7 +83,7 @@ EventManager.prototype.on = function on (event, callback, priority) {
if ( priority === void 0 ) priority = 0;


var listeners = this.listeners[event] || [];
var listeners = array(this.listeners[event]);
var index = listeners.findIndex(function (listener) { return listener.priority < priority; });

if (~index) {
Expand Down
59 changes: 31 additions & 28 deletions dist/vue-event-manager.esm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* vue-event-manager v2.0.0
* vue-event-manager v2.0.1
* https://github.com/pagekit/vue-event-manager
* Released under the MIT License.
*/
Expand All @@ -24,45 +24,48 @@ function forEach(collection, callback) {
});
}

/**
* Array.findIndex() polyfill.
*/
if (!Array.prototype.findIndex) {
function array(array) {
if ( array === void 0 ) array = [];

// eslint-disable-next-line
Object.defineProperty(Array.prototype, 'findIndex', {

value: function value(predicate) {
if (!array.findIndex) {
array.findIndex = findIndex;
}

if (this == null) {
throw new TypeError('"this" is null or not defined');
}
return array;
}

if (typeof predicate !== 'function') {
throw new TypeError('predicate must be a function');
}
/**
* Array.findIndex() polyfill.
*/
function findIndex(predicate) {

var o = Object(this);
var len = o.length >>> 0;
var thisArg = arguments[1];
if (this == null) {
throw new TypeError('"this" is null or not defined');
}

var k = 0;
if (typeof predicate !== 'function') {
throw new TypeError('predicate must be a function');
}

while (k < len) {
var o = Object(this);
var len = o.length >>> 0;
var thisArg = arguments[1];

var kValue = o[k];
var k = 0;

if (predicate.call(thisArg, kValue, k, o)) {
return k;
}
while (k < len) {

k++;
}
var kValue = o[k];

return -1;
if (predicate.call(thisArg, kValue, k, o)) {
return k;
}

});
k++;
}

return -1;
}

/**
Expand All @@ -78,7 +81,7 @@ EventManager.prototype.on = function on (event, callback, priority) {
if ( priority === void 0 ) priority = 0;


var listeners = this.listeners[event] || [];
var listeners = array(this.listeners[event]);
var index = listeners.findIndex(function (listener) { return listener.priority < priority; });

if (~index) {
Expand Down
Loading

0 comments on commit 8ad21a1

Please sign in to comment.