-
-
Save andresmijares/72c8dbe002709b7d48795d5c13545b4c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Model { | |
constructor (store = {}, services = []) { | |
this.services = services | |
this._store = store | |
} | |
asyncOperation (action, ...rest) { | |
return this.services.map((service) => { | |
if (service[action]) { | |
return service[action](this._store, ...rest) | |
} | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment