ducky/web

Paddy 2015-07-07 Parent:275a83e4c02e

21:bc1478742a50 Go to Latest

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?

History
1 import app from 'ampersand-app'
2 import Router from './router'
3 import Profiles from './models/profiles'
4 import Subscriptions from './models/subscriptions'
5 import Me from './models/me'
6 import normalize from 'normalize.css/normalize.css'
7 import styles from './styles/main.scss'
9 window.app = app.extend({
10 init () {
11 this.profiles = new Profiles()
12 this.subscriptions = new Subscriptions()
13 this.me = new Me().load()
14 this.me.on('change', this.me.debouncedWriteToCache)
15 this.router = new Router()
16 this.router.history.start()
17 }
18 })
20 app.init()