Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

mithril-firebase-mixin

kulakowka14MIT0.0.6

Mixin for mithril controllers to enable firebase livedata

mithril, firebase, livedata

readme

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