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

Commit

Permalink
v2.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Steffan committed Aug 23, 2018
1 parent 65d91fa commit 022c42c
Show file tree
Hide file tree
Showing 6 changed files with 161 additions and 77 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ $ npm install vue-event-manager
```

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

## Example
Expand Down
76 changes: 52 additions & 24 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.1.1
* vue-event-manager v2.1.2
* https://github.com/pagekit/vue-event-manager
* Released under the MIT License.
*/
Expand All @@ -10,10 +10,26 @@
* Utility functions.
*/

var _config = {};

var assign = Object.assign || _assign;

var isArray = Array.isArray;

function Util (ref) {
var config = ref.config;

_config = config;
}

function log(message, color) {
if ( color === void 0 ) color = '#41B883';

if (typeof console !== 'undefined' && _config.devtools) {
console.log(("%c vue-event-manager %c " + message + " "), 'color: #fff; background: #35495E; padding: 1px; border-radius: 3px 0 0 3px;', ("color: #fff; background: " + color + "; padding: 1px; border-radius: 0 3px 3px 0;"));
}
}

function isObject(val) {
return val !== null && typeof val === 'object';
}
Expand Down Expand Up @@ -199,38 +215,46 @@ Event.prototype.isPropagationStopped = function isPropagationStopped () {
};

/**
* Install plugin.
* Plugin class.
*/

var Events = new EventManager();

Events.install = function (Vue, options) {
if ( options === void 0 ) options = {};

var Plugin = {

if (this.installed) {
return;
}
version: '2.1.2',

// add global instance/methods
Vue.prototype.$events = Vue.events = assign(Events, options);
Vue.prototype.$trigger = function (event, params, asynch) {
if ( params === void 0 ) params = [];
if ( asynch === void 0 ) asynch = false;
install: function install(Vue, options) {
if ( options === void 0 ) options = {};


if (!isObject(event)) {
event = {name: event, origin: this};
if (this.installed) {
return;
}

return Events.trigger(event, params, asynch);
};
Util(Vue); log(this.version);

// add global instance/methods
Vue.prototype.$events = Vue.events = assign(Events, options);
Vue.prototype.$trigger = function (event, params, asynch) {
if ( params === void 0 ) params = [];
if ( asynch === void 0 ) asynch = false;


if (!isObject(event)) {
event = {name: event, origin: this};
}

return Events.trigger(event, params, asynch);
};

// add merge strategy for "events"
Vue.config.optionMergeStrategies.events = mergeEvents;
// add merge strategy for "events"
Vue.config.optionMergeStrategies.events = mergeEvents;

// add mixin to parse "events" from component options
Vue.mixin({beforeCreate: initEvents});
}

// add mixin to parse "events" from component options
Vue.mixin({beforeCreate: initEvents});
};

function mergeEvents(parentVal, childVal) {
Expand Down Expand Up @@ -282,7 +306,7 @@ function initEvents() {
listener = listener.handler;
}

_events.push(Events.on(event, bindListener(listener, this$1), priority));
_events.push(this$1.$events.on(event, bindListener(listener, this$1), priority));
});
});

Expand All @@ -301,8 +325,12 @@ function bindListener(fn, vm) {
return fn.bind(vm);
}

/**
* Install plugin.
*/

if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use(Events);
window.Vue.use(Plugin);
}

module.exports = Events;
module.exports = Plugin;
76 changes: 52 additions & 24 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.1.1
* vue-event-manager v2.1.2
* https://github.com/pagekit/vue-event-manager
* Released under the MIT License.
*/
Expand All @@ -8,10 +8,26 @@
* Utility functions.
*/

var _config = {};

var assign = Object.assign || _assign;

var isArray = Array.isArray;

function Util (ref) {
var config = ref.config;

_config = config;
}

function log(message, color) {
if ( color === void 0 ) color = '#41B883';

if (typeof console !== 'undefined' && _config.devtools) {
console.log(("%c vue-event-manager %c " + message + " "), 'color: #fff; background: #35495E; padding: 1px; border-radius: 3px 0 0 3px;', ("color: #fff; background: " + color + "; padding: 1px; border-radius: 0 3px 3px 0;"));
}
}

function isObject(val) {
return val !== null && typeof val === 'object';
}
Expand Down Expand Up @@ -197,38 +213,46 @@ Event.prototype.isPropagationStopped = function isPropagationStopped () {
};

/**
* Install plugin.
* Plugin class.
*/

var Events = new EventManager();

Events.install = function (Vue, options) {
if ( options === void 0 ) options = {};

var Plugin = {

if (this.installed) {
return;
}
version: '2.1.2',

// add global instance/methods
Vue.prototype.$events = Vue.events = assign(Events, options);
Vue.prototype.$trigger = function (event, params, asynch) {
if ( params === void 0 ) params = [];
if ( asynch === void 0 ) asynch = false;
install: function install(Vue, options) {
if ( options === void 0 ) options = {};


if (!isObject(event)) {
event = {name: event, origin: this};
if (this.installed) {
return;
}

return Events.trigger(event, params, asynch);
};
Util(Vue); log(this.version);

// add global instance/methods
Vue.prototype.$events = Vue.events = assign(Events, options);
Vue.prototype.$trigger = function (event, params, asynch) {
if ( params === void 0 ) params = [];
if ( asynch === void 0 ) asynch = false;


if (!isObject(event)) {
event = {name: event, origin: this};
}

return Events.trigger(event, params, asynch);
};

// add merge strategy for "events"
Vue.config.optionMergeStrategies.events = mergeEvents;
// add merge strategy for "events"
Vue.config.optionMergeStrategies.events = mergeEvents;

// add mixin to parse "events" from component options
Vue.mixin({beforeCreate: initEvents});
}

// add mixin to parse "events" from component options
Vue.mixin({beforeCreate: initEvents});
};

function mergeEvents(parentVal, childVal) {
Expand Down Expand Up @@ -280,7 +304,7 @@ function initEvents() {
listener = listener.handler;
}

_events.push(Events.on(event, bindListener(listener, this$1), priority));
_events.push(this$1.$events.on(event, bindListener(listener, this$1), priority));
});
});

Expand All @@ -299,8 +323,12 @@ function bindListener(fn, vm) {
return fn.bind(vm);
}

/**
* Install plugin.
*/

if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use(Events);
window.Vue.use(Plugin);
}

export default Events;
export default Plugin;
76 changes: 52 additions & 24 deletions dist/vue-event-manager.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* vue-event-manager v2.1.1
* vue-event-manager v2.1.2
* https://github.com/pagekit/vue-event-manager
* Released under the MIT License.
*/
Expand All @@ -14,10 +14,26 @@
* Utility functions.
*/

var _config = {};

var assign = Object.assign || _assign;

var isArray = Array.isArray;

function Util (ref) {
var config = ref.config;

_config = config;
}

function log(message, color) {
if ( color === void 0 ) color = '#41B883';

if (typeof console !== 'undefined' && _config.devtools) {
console.log(("%c vue-event-manager %c " + message + " "), 'color: #fff; background: #35495E; padding: 1px; border-radius: 3px 0 0 3px;', ("color: #fff; background: " + color + "; padding: 1px; border-radius: 0 3px 3px 0;"));
}
}

function isObject(val) {
return val !== null && typeof val === 'object';
}
Expand Down Expand Up @@ -203,38 +219,46 @@
};

/**
* Install plugin.
* Plugin class.
*/

var Events = new EventManager();

Events.install = function (Vue, options) {
if ( options === void 0 ) options = {};

var Plugin = {

if (this.installed) {
return;
}
version: '2.1.2',

// add global instance/methods
Vue.prototype.$events = Vue.events = assign(Events, options);
Vue.prototype.$trigger = function (event, params, asynch) {
if ( params === void 0 ) params = [];
if ( asynch === void 0 ) asynch = false;
install: function install(Vue, options) {
if ( options === void 0 ) options = {};


if (!isObject(event)) {
event = {name: event, origin: this};
if (this.installed) {
return;
}

return Events.trigger(event, params, asynch);
};
Util(Vue); log(this.version);

// add global instance/methods
Vue.prototype.$events = Vue.events = assign(Events, options);
Vue.prototype.$trigger = function (event, params, asynch) {
if ( params === void 0 ) params = [];
if ( asynch === void 0 ) asynch = false;


if (!isObject(event)) {
event = {name: event, origin: this};
}

return Events.trigger(event, params, asynch);
};

// add merge strategy for "events"
Vue.config.optionMergeStrategies.events = mergeEvents;
// add merge strategy for "events"
Vue.config.optionMergeStrategies.events = mergeEvents;

// add mixin to parse "events" from component options
Vue.mixin({beforeCreate: initEvents});
}

// add mixin to parse "events" from component options
Vue.mixin({beforeCreate: initEvents});
};

function mergeEvents(parentVal, childVal) {
Expand Down Expand Up @@ -286,7 +310,7 @@
listener = listener.handler;
}

_events.push(Events.on(event, bindListener(listener, this$1), priority));
_events.push(this$1.$events.on(event, bindListener(listener, this$1), priority));
});
});

Expand All @@ -305,10 +329,14 @@
return fn.bind(vm);
}

/**
* Install plugin.
*/

if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use(Events);
window.Vue.use(Plugin);
}

return Events;
return Plugin;

})));
Loading

0 comments on commit 022c42c

Please sign in to comment.