From b17cb48dbe906b446843ca1f4055df48c45d33f7 Mon Sep 17 00:00:00 2001 From: Brice Chevalier Date: Sat, 6 Jan 2018 12:17:00 +0900 Subject: [PATCH] Optimized Events.trigger method when no event is emitted --- src/core/Events.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/Events.js b/src/core/Events.js index bf5e936..5c619c2 100644 --- a/src/core/Events.js +++ b/src/core/Events.js @@ -84,7 +84,8 @@ var Common = require('./Common'); callbacks, eventClone; - if (object.events) { + var events = object.events; + if (events && Object.keys(events).length > 0) { if (!event) event = {}; @@ -92,7 +93,7 @@ var Common = require('./Common'); for (var i = 0; i < names.length; i++) { name = names[i]; - callbacks = object.events[name]; + callbacks = events[name]; if (callbacks) { eventClone = Common.clone(event, false);