amp-async-function

1.0.1 • Public • Published

amp-async-function

npm version Package Quality Build Status Coverage Status NPM Downloads dependencies devDependencies

Angular async function executor ES5 friendly.

Demo

Check out here.

Usage

Install amp-async-function using npm.

npm install amp-async-function --save

Include module amp-async-function into your app.

angular.module("my.app", ["amp-async-function"]);

Guide:

  • Inject the factory: asyncFunction;
  • Call your function: asyncFunction.execute(yourFunction, [] /*array of params*/, 0 /*delay*/);

Use the factory as example below:

    angular
        .module("async-func-demo")
        .controller("AsyncFuncController", AsyncFuncController);
 
 
    function AsyncFuncController(asyncFunction) {
        var vm = this;
        vm.exec = function () {
            asyncFunction.execute(vm.asyncFunc, [1], 10)
                .then(function (data) {
                // function resolved
                });
        }
 
        vm.asyncFunc = function (id) {
            return id;
        }
    }

Support on Beerpay

Hey dude! Help me out for a couple of 🍻!

Beerpay Beerpay

Package Sidebar

Install

npm i amp-async-function

Weekly Downloads

3

Version

1.0.1

License

MIT

Last publish

Collaborators

  • allansli