国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

angular.js - angular $interval callback function and promise
黃舟
黃舟 2017-05-15 16:58:59
0
1
626

As we all know, Angular’s ??$interval method is

$interval(fn, delay, [count], [invokeApply], [Pass]);

It returns a promise, which is generally used to handle different stages. promise.then(success,error,notify)For example, I use $interval to define a clock and test it

            var timer = $interval(function(){
                 console.log('inner');
             },2000,2);

             timer.then(success, error, notify);
             function success(){
                 console.log('done');
             }

             function error(){
                 console.log('error');
             }

             function notify(){
                 console.log('everytime');
The output result of

is

outputs
and inner at the same time every time. What is the difference between everytime's callback function $interval and promise's fn? notify

黃舟
黃舟

人生最曼妙的風(fēng)景,竟是內(nèi)心的淡定與從容!

reply all(1)
洪濤

The notify可能會(huì)被調(diào)用多次,這里只調(diào)用了一次,是因?yàn)槟?code>$interval的回調(diào)函數(shù)fnhere takes too little time.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template