Skip to content
This repository was archived by the owner on Feb 1, 2019. It is now read-only.

Commit 79043d7

Browse files
author
Steven Bellamy
committed
Fix for event trigger logic
1 parent bc635d9 commit 79043d7

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## [1.2.1] - 2016-11-29
8+
9+
### Changed
10+
11+
- Fix for event mixin trigger logic.
12+
713
## [1.2.0] - 2016-11-14
814

915
### Added

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "atomic-component",
3-
"version": "1.2.0",
3+
"version": "1.2.1s",
44
"description": "Basic Atomic Component",
55
"main": "index.js",
66
"scripts": {

src/mixins/Events.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,17 @@ var Events = {
3737
return this;
3838
},
3939

40-
/**
40+
/**
4141
* Function used to trigger events that exist on the event stack.
4242
*
4343
* @param {string} eventName - The name of the event to trigger.
4444
* @returns {object} An instance.
4545
*/
4646
trigger: function( eventName ) {
47-
var events = this.events = this.events || {};
48-
events[eventName] = events[eventName] || [];
47+
var events = this.events || {};
48+
if ( events.hasOwnProperty( eventName ) === false ) {
49+
return this;
50+
}
4951
for ( var i = 0, len = events[eventName].length; i < len; i++ ) {
5052
this.events[eventName][i].apply( this, arguments );
5153
}

0 commit comments

Comments
 (0)