html-next/ember-raf-scheduler

Name: ember-raf-scheduler

Owner: HTMLNext

Description: Simple generic scheduler that wraps the Ember runloop and requestAnimationFrame

Created: 2017-10-27 19:12:05.0

Updated: 2018-01-11 20:26:42.0

Pushed: 2018-01-18 20:38:11.0

Homepage: null

Size: 66

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Build Status

ember-raf-scheduler

Super simple RAF scheduler that integrates with the Ember runloop

Basics

Super simple example:

rt { scheduler } from 'ember-raf-scheduler';

chedule a job
t job = scheduler.schedule('measure', () => {
nsole.log('Hello, world!');


ancel the job
duler.forget(job);

There are 4 queues:

Tokens

Tokens can be created and passed into the scheduler. All jobs that were scheduled with a token can be cancelled by cancelling the parent token.

rt { scheduler, Token } from 'ember-raf-scheduler';

rt default Component.extend({
it() {
this.token = new Token();


llDestroy() {
scheduler.forget(this.token);


hedule(queue, job) {
scheduler.schedule(queue, job, this.token);


Perf Notes

Measurements in RAFs are basically free if you do them before any other DOM manipulation (same rules as standard forced layouts, etc), so you should batch all measurements in measure and if possible avoid using the sync and layout queues. There are times when it's necessary to do Ember specific manipulations (for instance, you need to use set and you want the template to render before you measure) which is what the sync and layout queues are for.

Installation
Running
Running Tests
Building

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


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.