Ember Promise Helpers

screenshot of Ember Promise Helpers

Promise-y sugar for your Ember templates.

Overview

Ember Promise Helpers is a library that aims to solve the problem of re-rendering templates when encountering promises in Ember's templates. By using Ember Promise Helpers, developers can easily work with Promises in their Ember templates without the need to wrap objects with Ember.PromiseProxyMixin in the Route, Controller, or Component.

Features

  • await: A helper that can be used anywhere as it is just a Handlebars subexpression. It can be passed to other helpers, components, or used by itself.
  • is-pending: Resolves with false if the promise is resolved or rejected, otherwise true until the promise resolves or rejects.
  • is-rejected: Resolves with true if the promise rejects or fails, otherwise false. Initial value is null until the promise is resolved.
  • is-fulfilled: Resolves with true if the promise resolved successfully, otherwise false. Initial value is null until the promise is resolved.
  • promise-rejected-reason: Gives the error or reason as to why a promise was rejected. Null until the promise rejects or if the promise resolves.
  • promise-all: Creates a promise using the Ember.RSVP.all function. It can accept 1..n promises as arguments or an array as the first argument.
  • promise-hash: Creates a promise using the Ember.RSVP.hash function.

Summary

Ember Promise Helpers is a useful library for Ember developers who encounter issues with promises in their templates. By providing a set of helpers, developers can easily work with promises and handle their states in a more efficient way. The installation process is straightforward and can be done by cloning the repository and installing the dependencies.

eslint
Eslint

ESLint is a linter for JavaScript that analyzes code to detect and report on potential problems and errors, as well as enforce consistent code style and best practices, helping developers to write cleaner, more maintainable code.