jeudi 18 février 2016

Using Firebase's JavaScript API in Emberfire/Ember CLI?

Been a heavy user of Emberfire for some time, but mostly "standard" usage of the add-on (i.e., the "blog post" model). I'm attempting to display metrics in a component/route that are updated via a bot, to take advantage of Firebase's "live-updating" feature.

For reference, the component would look roughly like this:

[name of metric (all, today, etc.)                              ]
[most-used emoticon id: no. of times used | second most-used ...]

However, I can't find any resources regarding either jumping into the Javascript API within Ember CLI or accessing nested, non-sequential data like the below in Ember Data.

"metrics" : {
  "{channel}" : {
    "emotes" : {
      "all" : {
        "62328" : 1 // "id of the emoticon: count"
      },
      "daily" : {
        "20160216" : {
          "62328" : 1
        }
      },
      "monthly" : {
        "201602" : {
          "62328" : 1
        }
      }
    }
  }
}

While I'm sure Ember Data is not made for this use case, is there any way I can access the JavaScript API in an Ember CLI app? Also, if there's a way I can structure the above to more easily take advantage of Emberfire's features, I'd greatly appreciate it.




Aucun commentaire:

Enregistrer un commentaire