Skip to content

Commit

Permalink
Group bindings in the readit aspect by emitter (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgonggrijp committed Jul 2, 2020
1 parent 17f71f5 commit f690393
Showing 1 changed file with 19 additions and 28 deletions.
47 changes: 19 additions & 28 deletions frontend/src/aspects/readit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,69 +26,60 @@ history.once('route', () => {
explorerView.setHeight(availableHeight).render();
uploadSourceForm.setHeight(availableHeight);
});
menuView.on('feedback', () => { feedbackView.render().$el.appendTo('body'); });
feedbackView.on('close', () => feedbackView.$el.detach());

directionRouter.on('route:register', () => {
userFsm.handle('register');
});

directionRouter.on('route:confirm-registration', (key) => {
confirmRegistrationView.processKey(key);
directionFsm.handle('confirm');
});
user.on('confirm-registration:success', () => confirmRegistrationView.success());
user.on('confirm-registration:notfound', () => confirmRegistrationView.notFound());
user.on('confirm-registration:error', (response) => confirmRegistrationView.error(response));
directionRouter.on('route:arrive', () => {
directionFsm.handle('arrive');
userFsm.handle('arrive');
});
directionRouter.on('route:upload', () => {
userFsm.handle('upload');
});
directionRouter.on('route:explore', () => {
userFsm.handle('explore');
});
directionRouter.on('route:leave', () => {
userFsm.handle('leave');
});

directionFsm.on('enter:confirming', () => {
confirmRegistrationView.render().$el.appendTo('#main');
});

directionFsm.on('exit:confirming', () => {
confirmRegistrationView.$el.detach();
});

directionRouter.on('route:arrive', () => {
directionFsm.handle('arrive');
userFsm.handle('arrive');
});

userFsm.on('enter:arriving', () => {
welcomeView.render().$el.appendTo('#main');
});

userFsm.on('exit:arriving', () => {
welcomeView.$el.detach();
});

directionRouter.on('route:upload', () => {
userFsm.handle('upload');
});

userFsm.on('enter:uploading', () => {
uploadSourceForm.render().$el.appendTo('#main');
});

userFsm.on('exit:uploading', () => {
uploadSourceForm.reset();
uploadSourceForm.$el.detach();
});

directionRouter.on('route:explore', () => {
userFsm.handle('explore');
});

userFsm.on('enter:exploring', () => {
ensureSources();
welcomeView.$el.detach();
explorerView.$el.appendTo('#main');
});

userFsm.on('exit:exploring', () => {
if (explorerView) explorerView.$el.detach();
});

directionRouter.on('route:leave', () => {
userFsm.handle('leave');
});
menuView.on('feedback', () => { feedbackView.render().$el.appendTo('body'); });
feedbackView.on('close', () => feedbackView.$el.detach());

user.on('confirm-registration:success', () => confirmRegistrationView.success());
user.on('confirm-registration:notfound', () => confirmRegistrationView.notFound());
user.on('confirm-registration:error', (response) => confirmRegistrationView.error(response));

0 comments on commit f690393

Please sign in to comment.