1.0.1 • Published 8 years ago

amp-async-function v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

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 :beers:!

Beerpay Beerpay