summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2016-12-22 11:43:16 -0700
committermo khan <mo@mokhan.ca>2016-12-22 11:43:16 -0700
commitc46de15a5454f0083ade267b6cb949bbd63e2be5 (patch)
treefc74001dfa0eade737741d4a0161f22c6c0c1bf2
parente8de35b6df6bae432c789344889be9e4c4351d00 (diff)
inline methods.
-rw-r--r--app/boot/wire-up-components-into.js26
1 files changed, 8 insertions, 18 deletions
diff --git a/app/boot/wire-up-components-into.js b/app/boot/wire-up-components-into.js
index 33c07a4..5624638 100644
--- a/app/boot/wire-up-components-into.js
+++ b/app/boot/wire-up-components-into.js
@@ -21,28 +21,18 @@ export default class WireUpComponentsInto {
this.registry.register('applicationStorage', ApplicationStorage).asSingleton();
this.registry.register('sessionsApi', () => new Api('/sessions')).asSingleton();
this.registry.register('workoutsApi', () => new Api('/workouts')).asSingleton();
- this.registerCommandsInto(this.registry);
- this.registerQueriesInto(this.registry);
+ this.registerSubscribers(commands);
+ this.registerSubscribers(queries);
return this.registry;
}
- registerCommandsInto(registry) {
- for (let command in commands) {
- console.log(`registering: ${command}`);
- registry.register('command', commands[command]).asSingleton();
+ registerSubscribers(subscribers) {
+ for (let subscriber in subscribers) {
+ console.log(`registering: ${subscriber}`);
+ this.registry.register('subscriber', subscribers[subscriber]).asSingleton();
}
- registry.resolveAll("command").forEach((command) => {
- command.subscribeTo(registry.resolve('eventAggregator'));
- });
- }
-
- registerQueriesInto(registry) {
- for (let query in queries) {
- console.log(`registering: ${query}`);
- registry.register('query', queries[query]).asSingleton();
- }
- registry.resolveAll("query").forEach((query) => {
- query.subscribeTo(registry.resolve('eventAggregator'));
+ this.registry.resolveAll("subscriber").forEach((subscriber) => {
+ subscriber.subscribeTo(this.registry.resolve('eventAggregator'));
});
}
}