mochiscript 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -241,9 +241,9 @@ var JS2 = $m;
241
241
  })(undefined, $m);
242
242
 
243
243
 
244
- $m.Class.extend("EventEmitter", function(KLASS, OO){
244
+ $m.Module.extend("EventEmitter", function(KLASS, OO){
245
245
 
246
- this._maxListeners = 10;
246
+ var MAX_LISTENERS = 10;
247
247
  var isArray = Array.isArray;
248
248
 
249
249
 
@@ -334,8 +334,8 @@ $m.Class.extend("EventEmitter", function(KLASS, OO){
334
334
  // Check for listener leak
335
335
  if (isArray(this._events[type]) && !this._events[type].warned) {
336
336
  var m;
337
- if (this._maxListeners !== undefined) {
338
- m = this._maxListeners;
337
+ if (MAX_LISTENERS !== undefined) {
338
+ m = MAX_LISTENERS;
339
339
  } else {
340
340
  m = defaultMaxListeners;
341
341
  }
@@ -353,6 +353,10 @@ $m.Class.extend("EventEmitter", function(KLASS, OO){
353
353
  return this;
354
354
  });
355
355
 
356
+ OO.addMember("on", function(type, listener){
357
+ this.addListener(type, listener);
358
+ });
359
+
356
360
  OO.addMember("once", function(type, listener){
357
361
  if ('function' !== typeof listener) {
358
362
  throw new Error('.once only takes instances of Function');
@@ -1,3 +1,3 @@
1
1
  module Mochiscript
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
@@ -206,9 +206,9 @@ window.$m = $m;
206
206
  })(undefined, $m);
207
207
 
208
208
 
209
- $m.Class.extend("EventEmitter", function(KLASS, OO){
209
+ $m.Module.extend("EventEmitter", function(KLASS, OO){
210
210
 
211
- this._maxListeners = 10;
211
+ var MAX_LISTENERS = 10;
212
212
  var isArray = Array.isArray;
213
213
 
214
214
 
@@ -299,8 +299,8 @@ $m.Class.extend("EventEmitter", function(KLASS, OO){
299
299
  // Check for listener leak
300
300
  if (isArray(this._events[type]) && !this._events[type].warned) {
301
301
  var m;
302
- if (this._maxListeners !== undefined) {
303
- m = this._maxListeners;
302
+ if (MAX_LISTENERS !== undefined) {
303
+ m = MAX_LISTENERS;
304
304
  } else {
305
305
  m = defaultMaxListeners;
306
306
  }
@@ -318,6 +318,10 @@ $m.Class.extend("EventEmitter", function(KLASS, OO){
318
318
  return this;
319
319
  });
320
320
 
321
+ OO.addMember("on", function(type, listener){
322
+ this.addListener(type, listener);
323
+ });
324
+
321
325
  OO.addMember("once", function(type, listener){
322
326
  if ('function' !== typeof listener) {
323
327
  throw new Error('.once only takes instances of Function');
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: mochiscript
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.5.0
5
+ version: 0.5.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jeff Su