私はcoffeescriptの使用にかなり慣れていないので、次のコードを持っています
eventBus = require './eventBus'
class Aggregate
constructor(id) ->
@_id = id
@find: (id) ->
console.log "Find Called"
new Aggregate(id)
@apply: (event) ->
@_total += event.attribute.amount
@emit: (event) ->
EventBus.store event
module.Aggregate = Aggregate
私が抱えている問題は、 Aggregate.find 20 を呼び出して、その ID を持つ新しい集計を返すことです。このモジュールをこのように機能させる方法についてのアドバイスは大歓迎です。
乾杯マイク。