Nightly Panic Munchies

    metrics-decorators

    0.0.1 • Public • Published

    metrics-decorators

    Exposes ember-metrics API as ES7 decorators.

    This is inspired/derived from the ember-computed-decorators project.

    Setup

    • ember install metrics-decorators

    Configure

    In order to make use of ES7 decorators, you'll need to configure your project to enable babel support for them.

    This is as simple as adding the following to ember-cli-build.js:

    var app = new EmberApp({
      babel: {
        optional: ['es7.decorators']
      }
    });

    Example

    import Route from 'ember-route';
    import { trackEvent, trackPage, invoke } from 'metrics-decorators';
     
    export default Route.extend({
      actions: {
        @trackEvent('GoogleAnalytics', 'action', 'submit', 'sign up form')
        handleSubmit(model) {
          return model.save();
        },
     
        @invoke('trackLink', 'Piwik', { linkType: 'download' })
        saveForm(model) {
          return model.download();
        }
      },
     
      @trackPage('GoogleAnalytics', 'sign up form')
      model() {
        return this.store.createRecord('user');
      }
    })

    Installation

    • git clone <repository-url> this repository
    • cd metrics-decorators
    • npm install
    • bower install

    Running

    Running Tests

    • npm test (Runs ember try:each to test your addon against multiple Ember versions)
    • ember test
    • ember test --server

    Building

    • ember build

    For more information on using ember-cli, visit http://ember-cli.com/.

    Install

    npm i metrics-decorators

    DownloadsWeekly Downloads

    7

    Version

    0.0.1

    License

    MIT

    Last publish

    Collaborators

    • jasonmit