All Projects → ember-app-scheduler → ember-app-scheduler

ember-app-scheduler / ember-app-scheduler

Licence: MIT license
An Ember addon to schedule work until after the initial render.

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects
Handlebars
879 projects
HTML
75241 projects

Projects that are alternatives of or similar to ember-app-scheduler

ember-legit-forms
Component for creating flexible forms along with validations.
Stars: ✭ 41 (-38.81%)
Mutual labels:  ember, addon
ember-osf
Ember Addon for interacting with the Open Science Framework
Stars: ✭ 14 (-79.1%)
Mutual labels:  ember, addon
Ember Power Calendar
Powerful and customizable calendar component for Ember
Stars: ✭ 200 (+198.51%)
Mutual labels:  ember, addon
Ember Pikaday
A datepicker component for Ember CLI projects.
Stars: ✭ 151 (+125.37%)
Mutual labels:  ember, addon
ember-contextual-services
Services in Ember are scoped to the app as a whole and are singletons. Sometimes you don't want that. :) This addon provides ephemeral route-based services.
Stars: ✭ 20 (-70.15%)
Mutual labels:  ember, addon
Ember File Upload
HTML5 file uploads for Ember apps
Stars: ✭ 172 (+156.72%)
Mutual labels:  ember, addon
ember-window-messenger
This aims to be an simple window postMessage services provider.
Stars: ✭ 17 (-74.63%)
Mutual labels:  ember, addon
Ember Socket Guru
Addon for easy integration with Pusher.js, ActionCable, Socket.io and Phoenix Channels
Stars: ✭ 119 (+77.61%)
Mutual labels:  ember, addon
ember-audio
An Ember addon that makes working with the Web Audio API super EZ.
Stars: ✭ 33 (-50.75%)
Mutual labels:  ember, addon
ember-right-click-menu
An easy and flexible addon to add context menus anywhere in your application
Stars: ✭ 14 (-79.1%)
Mutual labels:  ember, addon
Ember Web App
NOTICE: official repository moved to https://github.com/zonkyio/ember-web-app
Stars: ✭ 143 (+113.43%)
Mutual labels:  ember, addon
ember-best-language
🏳 A FastBoot-enabled addon to detect the best language for your user.
Stars: ✭ 18 (-73.13%)
Mutual labels:  ember, addon
Ember Basic Dropdown
The basic dropdown you ember app needs
Stars: ✭ 140 (+108.96%)
Mutual labels:  ember, addon
Ember Page Title
Page title management for Ember.js Apps
Stars: ✭ 177 (+164.18%)
Mutual labels:  ember, addon
Ember Data Url Templates
an ember-addon to allow building urls with url templates instead of defining buildURL
Stars: ✭ 130 (+94.03%)
Mutual labels:  ember, addon
Ember Font Awesome
ember-cli addon for using Font Awesome icons in Ember apps
Stars: ✭ 225 (+235.82%)
Mutual labels:  ember, addon
Ember Searchable Select
Data-down, actions up select-like menu with searching and tagging capabilities.
Stars: ✭ 38 (-43.28%)
Mutual labels:  ember, addon
Ember Attacher
Native tooltips and popovers for Ember.js
Stars: ✭ 69 (+2.99%)
Mutual labels:  ember, addon
ember-vertical-timeline
A Vertical Timeline for Ember.js apps 🚀
Stars: ✭ 19 (-71.64%)
Mutual labels:  ember, addon
ember-app-shell
No description or website provided.
Stars: ✭ 23 (-65.67%)
Mutual labels:  ember, addon

ember-app-scheduler

CI Build Ember Observer Score npm version Monthly Downloads from NPM Code Style: prettier

Ember batches DOM updates and paints them after every run loop to prevent layout thrashing. Layout thrashing can prevent a faster First Meaningful Paint (FMP) because all the content of the page is painted at once.

As a way to mitigate the need to render all content at once regardless of its visual priority, some work done on the page like ads, analytics tracking, rendering non critical content, rendering content outside viewport etc. can be deferred to achieve a faster FMP. This work can be delayed to run after the FMP and achieve incremental rendering of the page.

This addon provides a way to defer work into different paint phases of the rendering process to get a faster FMP. It also helps to prioritize and coordinate when the paint happens for different parts of the page.

The documentation website contains more examples and API information.

Compatibility

  • Ember.js v3.16 or above
  • Ember CLI v2.13 or above
  • Node.js v12 or above

Installation

ember install ember-app-scheduler

Usage

The ember-app-scheduler addon connects its functionality via the application's router. By connecting to the router's routeWillChange/routeDidChange hooks (willTransition/didTransition in Ember < 3.6), it ensures that the timing of its API is in sync with the application's timings.

To connect to your router, import setupRouter and reset from ember-app-scheduler and invoke them:

import EmberRouter from '@ember/routing/router';
import { inject as service } from '@ember/service';
import { setupRouter, reset } from 'ember-app-scheduler';
import config from './config/environment';

export default class Router extends EmberRouter {
  location = config.locationType;
  rootURL = config.rootURL;

  @service router;

  constructor() {
    super(...arguments);

    setupRouter(this.router);
  }
}

Router.map(function() {
  // ...
});

Note: There is a bug in Ember.js < 3.26 which may result in Uncaught RangeError: Maximum call stack size exceeded and you may need to use setupRouter(this) instead and deal with deprecation message until you are able to upgrade to 3.26. For more info see emberjs/ember.js#17791

You can then use one of the provided APIs to defer work.

whenRouteIdle

By deferring work until the route is idle (approximately after the first paint completes), we delay non-critical work. To do this, you can import and use the whenRouteIdle function. This is useful for scenarios like rendering ads, scheduling tracking work, rendering of popup overlays etc.

In most cases, the whenRouteIdle function is all you need to defer work, though ember-app-scheduler does expose other functions.

import Route from '@ember/routing/route';
import { whenRouteIdle } from 'ember-app-scheduler';

export default class IdleRoute extends Route {
  activate() {
    super.activate(...arguments);

    whenRouteIdle().then(() => {
      // do non-critical work
    });
  }
}

Contributing

See the Contributing guide for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].