diff options
| author | Juuso Lapinlampi <wub@partyvan.eu> | 2015-11-18 17:24:14 +0100 |
|---|---|---|
| committer | Juuso Lapinlampi <wub@partyvan.eu> | 2015-11-18 17:47:30 +0100 |
| commit | c257a1c1d63197f5349c12962558eccc7837a0f5 (patch) | |
| tree | 5f14ff64d772fdcd4ff9dac1512628428707ce44 /js/cabinet.js | |
| parent | c950e85c8248800f321e280c16a48f15a35e8d4a (diff) | |
Refactor cheesesteak.js EventEmitter emit function
Previous commit c950e85 came with a workaround to resolve a TypeError in
EventEmitter.prototype.emit for-loop. That workaround sacrificed some
readability for bug fixing due to technical debt.
bursey came up with a better solution on IRC which seems to work and
improves readability. Something needs to emit an event that wasn't bound
with "on", thus the event was not in the _events object.
Airbnb ES5 style guide requires to have all variables at top, so we
leave the len variable undefined at the top to be defined later. After
the _events check, we define len to avoid the TypeError issue while
conforming to Airbnb ES5 style guide and improving readability.
This commit also adds comments to document the function.
Suggested-by: bursey (#/g/partyvan @ Partyvan IRC)
Diffstat (limited to 'js/cabinet.js')
0 files changed, 0 insertions, 0 deletions
