aop-function
function aop plugin
Last updated 4 years ago by holyselina .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install aop-function 
SYNC missed versions from official npm registry.

aop-function

nodejs function aop plugin



 var aop = require('aop-function');
 
 //target function
 var kill = function(who,blood,callback){
    setTimeout(function(){
       console.log('kill==>',who,':',blood);
       callback();
    },500);
 }
 
 kill = aop(kill,function aop1(who,blood,next){
    console.log('this is aop1 start ')
    setTimeout(function(){
       next(null,function(nxt){
         console.log('this is aop1 end ');
         nxt();
       });
    },500);
 }
 ,function aop2(who,blood,next){
   console.log('this is aop2 start')
    setTimeout(function(){
       next(null,function(nxt){
         console.log('this is aop2 end ');
         nxt();
       });
    },500);
 }
 ,function aop3(who,blood,next){
   console.log('this is aop3 start')
    setTimeout(function(){
       next(null,function(nxt){
         console.log('this is aop3 end ');
         nxt();
       });
    },500);
 }
 );
 
 kill('bad-man',1000,function(err){
   console.log('kill finish ');
 })
 
 

Current Tags

  • 1.0.0                                ...           latest (4 years ago)

1 Versions

  • 1.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (3)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |