Skip to content
Angular action delay timer.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
README.md
angular-action-timer.js
angular-action-timer.min.js
angular-action-timer.spec.js
bower.json
gulpfile.js
karma.conf.js
package.json

README.md

angular-action-timer

Angular action delay timer.

Demo

Delay an action (Function) every time it is scheduled. So action is only invoked once if schedule continually but within the delay time each time.

Useful when some function need to be invoked after user "stop" doing something continually.

Install

Bower

bower install angular-action-timer
angular.module('app', ['ng.actionTimer']);

Example

angular.module('demo', ['ng.event', 'ng.actionTimer'])
  .factory('demoTrigger', demoTrigger);
  
function demoTrigger(evtDemoTriggered, actionTimer) {
  var timer = actionTimer(trigger, 500);
  return {
    execute: execute
  };

  function execute() {
    timer.schedule();
  }

  function trigger() {
    evtDemoTriggered.emit();
  }
}  

API

actionTimer(action, delay?)

Create a timer that invoke action after scheduled for delay (or 100ms if delay is omitted).

schedule(delay?)

Schedule timer for delay (or default delay if omitted).

when(promise, delay?)

Schedule timer for delay (or default delay if omitted) after promise.then().

after(promise, delay?)

Schedule timer for delay (or default delay if omitted) after promise.finally().

cancel()

Cancel scheduled timer.

You can’t perform that action at this time.