npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ember-runloop-decorators

v0.0.2

Published

Decorators for `@ember/runloop`

Downloads

7

Readme

ember-runloop-decorators

CI npm version Download Total Ember Observer Score code style: prettier dependencies devDependencies

Decorators for @ember/runloop.

Installation

ember install ember-runloop-decorators

Usage

@inRunLoop

class Foo {
  @inRunLoop
  runInRunLoop() {
    // If no run-loop is present, it creates a new one. If a run loop is
    // present, it will queue itself to run on the existing run-loop's
    // `actions` queue.
  }
}

@joinRunLoop

class Foo {
  @joinRunLoop
  runInRunLoop() {
    // If no run-loop is present, it creates a new one. If a run loop is
    // present, it will queue itself to run on the existing run-loop's
    // `actions` queue.
  }
}

@bind

class Foo {
  @bind
  onActionsQueue() {
    // This will be executed in the `actions` queue.
  }
 *
  @bind('sync')
  onActionsQueue() {
    // This will be executed in the `sync` queue.
  }
}

@schedule

class Foo {
  @schedule
  onActionsQueue() {
    // This will be executed in the `actions` queue.
  }
 *
  @schedule('sync')
  onActionsQueue() {
    // This will be executed in the `sync` queue.
  }
}

@scheduleOnce

class Foo {
  @schedule
  onActionsQueue() {
    // This will be executed in the `actions` queue.
  }
 *
  @schedule('sync')
  onActionsQueue() {
    // This will be executed in the `sync` queue.
  }
}

@once

class Foo {
  @once
  onceInCurrentRunLoop() {
    // If no run-loop is present, it creates a new one. If a run loop is
    // present, it will queue itself to run on the existing run-loop's
    // `actions` queue.
  }
}

@later

class Foo {
  @later(100)
  after100ms() {
    // Delay calling the method until the wait period has elapsed.
    // Additional calls enqueue additional executions.
  }
}

@next

class Foo {
  @next
  inRunLoop() {
    // If no run-loop is present, it creates a new one. If a run loop is
    // present, it will queue itself to run on the existing run-loops action
    // queue.
  }
}

@debounce

class Foo {
  @debounce(100)
  after100ms() {
    // Delay calling the method until the debounce period has elapsed with
    // no additional calls. If called again before the specified time has
    // elapsed, the timer is reset and the entire period must pass again
    // before the method is called.
  }
 *
  @debounce(100, true)
  immediatelyAndAfter100ms() {
    // Run the method immediately, but debounce other calls for this method
    // until the wait time has elapsed. If called again before the specified
    // time has elapsed, the timer is reset and the entire period must pass
    // again before the method can be called again.
  }
}

@throttle

class Foo {
  @throttle(100)
  every100ms() {
    // Ensure that the method is never called more frequently than the
    // specified spacing period. The method is called immediately.
  }
 *
  @debounce(100, false)
  delayedByAndEvery100ms() {
    // Ensure that the method is never called more frequently than the
    // specified spacing period. The method is called after the first spacing
    // period has elapsed.
  }
}