Giter Site home page Giter Site logo

doc22940 / ember-decorators Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ef4/ember-decorators

0.0 1.0 0.0 6.21 MB

Useful decorators for Ember applications.

Home Page: https://ember-decorators.github.io/ember-decorators

JavaScript 96.36% HTML 1.55% CSS 0.01% TypeScript 2.08%

ember-decorators's Introduction

Ember Decorators

npm version Build Status

Ember Decorators is a project dedicated to exploring and unlocking the future of native classes in Ember.js. Its goal is to provide a set of decorators which can be used to write native classes with every standard feature that is available in Ember, along with the transforms and build system required to polyfill and ship them in your app today!

The documentation website for Ember Decorators contains a detailed guide on using native classes with Ember today, along with detailed API documentation for all the decorators included in this library.

Usage

First install the main ember-decorators addon.

ember install ember-decorators

This addon doesn't contain any decorators itself, but includes the core set of subaddons that are necessary to begin writing Ember using native classes:

  • @ember-decorators/component
  • @ember-decorators/controller
  • @ember-decorators/data
  • @ember-decorators/object
  • @ember-decorators/service

Usage in Applications

In your application where you would normally have:

import Ember from 'ember';

export default Ember.Component.extend({
  foo: Ember.inject.service(),

  bar: Ember.computed('someKey', 'otherKey', function() {
    var someKey = this.get('someKey');
    var otherKey = this.get('otherKey');

    return `${someKey} - ${otherKey}`;
  }),

  actions: {
    handleClick() {
      // do stuff
    }
  }
})

You replace it with this:

import Component from '@ember/component';
import { action, computed } from '@ember-decorators/object';
import { service } from '@ember-decorators/service';

export default class ExampleComponent extends Component {
  @service foo

  @computed('someKey', 'otherKey')
  get bar() {
    const someKey = this.get('someKey');
    const otherKey = this.get('otherKey');
    return `${someKey} - ${otherKey}`;
  }

  @action
  handleClick() {
    // do stuff
  }
}

See the API Documentation for detailed examples and documentation of the individual decorators.

Development

Organization

This repository consists of multiple packages managed with lerna.js. The decorators all reside in their own individual packages under /packages, along with the main ember-decorators package.

The main package serves three purposes:

  1. A quick way to install all of the subpackages and get new projects up and running. Installing the main package also adds any necessary babel transforms, and sets up ESLint properly.
  2. A place for common functionality, such as the native class blueprints that overwrite the default Ember blueprints.
  3. A place for the documentation site and tests for all of the other addons. Tests were consolidated from the other addons in order to speed up the testing and development process.

Setting up

  • Fork the repository
  • git clone <your-fork-url>
  • cd ember-decorators
  • npm install

Linting

  • npm run lint:js
  • npm run lint:js -- --fix

Running tests

  • npm test โ€“ Runs the test suite on the current Ember version

Running the dummy application

License

This project is licensed under the MIT License.

ember-decorators's People

Contributors

pzuraq avatar rwjblue avatar xiphiasuvella avatar stefanpenner avatar buschtoens avatar nullvoxpopuli avatar mike-north avatar ed-asriyan avatar machty avatar richard-viney avatar locks avatar trabus avatar championswimmer avatar kerrick avatar kturney avatar lennyburdette avatar allthesignals avatar linearza avatar localpcguy avatar knownsubset avatar quantuminformation avatar patsy-issa avatar spieker avatar paulcwatts avatar rlivsey avatar snewcomer avatar seanpdoyle avatar serchavalos avatar ember-tomster avatar zacharygolba avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.