0.0.6 • Published 8 years ago

mithril-firebase-mixin v0.0.6

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

mithril-firebase-mixin

Mixin for mithril controllers to enable firebase livedata

import m from 'mithril'
import firebaseMixin from 'mithril-firebase-mixin'

const ref = new Firebase('https://<myfirebase>.firebaseio.com')

const Example = {
  controller (args) {
    firebaseMixin(m, this)

    this.onData(ref.child('users/kulakowka'), (data) => (this.user = data))
    this.onLiveData(ref.child('users'), (data) => (this.users = data))
  },

  view (ctrl) {
    return (
      {ctrl.user && ctrl.user.username}

      <ul>
        {ctrl.users && ctrl.users.map(user => {
          <li>{user.username}</li>
        })}
      </ul>
    )
  }
}

export default Example
0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago