ducky/web
2015-07-07
Parent:275a83e4c02e
ducky/web/src/main.js
Implement subscriptions. Create a Subscription model and a Subscriptions collection, and attach them to the app context. Add a helper to our Profile model to retrieve the Subscription of that model. Still not sure this should be on the Profile--wouldn't it be better on the Me model? Isn't that generally where we would need it?
| paddy@0 | 1 import app from 'ampersand-app' |
| paddy@0 | 2 import Router from './router' |
| paddy@0 | 3 import Profiles from './models/profiles' |
| paddy@21 | 4 import Subscriptions from './models/subscriptions' |
| paddy@0 | 5 import Me from './models/me' |
| paddy@0 | 6 import normalize from 'normalize.css/normalize.css' |
| paddy@0 | 7 import styles from './styles/main.scss' |
| paddy@0 | 8 |
| paddy@0 | 9 window.app = app.extend({ |
| paddy@0 | 10 init () { |
| paddy@0 | 11 this.profiles = new Profiles() |
| paddy@21 | 12 this.subscriptions = new Subscriptions() |
| paddy@14 | 13 this.me = new Me().load() |
| paddy@14 | 14 this.me.on('change', this.me.debouncedWriteToCache) |
| paddy@0 | 15 this.router = new Router() |
| paddy@21 | 16 this.router.history.start() |
| paddy@0 | 17 } |
| paddy@0 | 18 }) |
| paddy@0 | 19 |
| paddy@0 | 20 app.init() |