mirror of
https://github.com/liabru/matter-js.git
synced 2024-12-25 13:39:06 -05:00
Merge branch 'pr/553’
* pr/553: Optimized Events.trigger method when no event is emitted
This commit is contained in:
commit
7894b4b44d
1 changed files with 4 additions and 2 deletions
|
@ -84,7 +84,9 @@ var Common = require('./Common');
|
||||||
callbacks,
|
callbacks,
|
||||||
eventClone;
|
eventClone;
|
||||||
|
|
||||||
if (object.events) {
|
var events = object.events;
|
||||||
|
|
||||||
|
if (events && Common.keys(events).length > 0) {
|
||||||
if (!event)
|
if (!event)
|
||||||
event = {};
|
event = {};
|
||||||
|
|
||||||
|
@ -92,7 +94,7 @@ var Common = require('./Common');
|
||||||
|
|
||||||
for (var i = 0; i < names.length; i++) {
|
for (var i = 0; i < names.length; i++) {
|
||||||
name = names[i];
|
name = names[i];
|
||||||
callbacks = object.events[name];
|
callbacks = events[name];
|
||||||
|
|
||||||
if (callbacks) {
|
if (callbacks) {
|
||||||
eventClone = Common.clone(event, false);
|
eventClone = Common.clone(event, false);
|
||||||
|
|
Loading…
Reference in a new issue