N"OWw RIWWITNHK AAAAAARR DER PROTOROPYTEP PORPERTY>111..
Unfolded:

events = require "events"

instances_counter = 0
module.exports = (
  -> 
    __class = (-> 
      __args = Array.prototype.slice.call(arguments)
      if @ instanceof __class
        @constructor?.apply(@,__args) if __class isnt @constructor;@
      else 
        new (Function.prototype.bind.apply(__class,[null].concat(__args)))
    );
    __class.prototype = if @prototype? then Object.create(@prototype.prototype) else @;
    __class.prototype[__prop] = @[__prop] for __prop of @ if @prototype?;
    __class).apply

  prototype: events.EventEmitter

  constructor: (@param1,@param2) ->
    @prototype.apply @
    @id = ++instances_counter

  render: ->
    console.log @,instances_counter,@ instanceof module.exports

a = new module.exports()
a.render()
b = new module.exports()
b.render()
console.log a instanceof events.EventEmitter
console.log a instanceof module.exports

Folded:

events = require "events"

instances_counter = 0
module.exports = (-> __class = (-> __args = Array.prototype.slice.call(arguments); if @ instanceof __class then @constructor?.apply(@,__args) if __class isnt @constructor;@ else new (Function.prototype.bind.apply(__class,[null].concat(__args)))); __class.prototype = (if @prototype? then Object.create(@prototype.prototype) else @); (__class.prototype[__prop] = @[__prop] for __prop of @ if @prototype?); __class).apply

  prototype: events.EventEmitter

  constructor: (@param1,@param2) ->
    @prototype.apply @
    @id = ++instances_counter

  render: ->
    console.log @,instances_counter,@ instanceof module.exports

a = new module.exports()
a.render()
b = new module.exports()
b.render()
console.log a instanceof events.EventEmitter
console.log a instanceof module.exports
[ ]
 

P.S. Присылайте криптовалюту если вам нравится то, что я делаю.
Если не нравится - тоже присылайте.
LTC (Litecoin): LLN6X2uV1iuQ1e4tdmQZsf2RRwh4pxPSej

Leave a Reply

*