Giter Club home page Giter Club logo

ember-promise-cps's Introduction

ember-promise-cps

       

This Ember addon provides you with utils and computed property macros to aid with common problems when working with promises in components.

  1. Subsequent promises take priorty over 'old' promises
    (You're usually only ever bothered about the result from the most recent promise)
  2. Setting the result of the promise on the component when the component may since have been destroyed will error.

No longer maintained

Please use http://ember-concurrency.com instead

Example

{{! application.hbs }}
{{items-list items-promise=promiseForItems}}
// items-list/component.js
import { promiseObject } from 'ember-promise-cps/macros';

export default Component.extend({
  items: promiseArray('items-promise')
});
{{! items-list/template.hbs }}
{{#if items.isPending}}
  Loading items
{{else if items.isRejected}}
  Unable to display items: {{items.reason}}
{{else if items.isFulfilled}}
  {{#each items as |item|}}
    ...
  {{/each}}
{{/if}}

Available utils/macros

  • Utils
    • promiseObject({ foo: 'bar' })
    • promiseArray([ 'foo', 'bar' ])
  • Macros
    • promiseObject('myObject')
    • promiseArray('myArray')

Installation

ember install ember-promise-cps

ember-promise-cps's People

Contributors

amk221 avatar ember-tomster avatar

Watchers

 avatar  avatar  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.