1.0.6 • Published 10 years ago

vz.resolve v1.0.6

Weekly downloads
3
License
LGPL-3.0
Repository
github
Last release
10 years ago

vz resolve

DEPRECATED in favour of vz.yielded

NPM

No piece of software is ever completed, feel free to contribute and be humble

Sample usage:

var resolve = require('vz.resolve'),
    nextTick = require('vz.next-tick'),
    result;

result = resolve(function solve(){
  if(Math.random() < 0.5) this.resolve('Hello world');
  else nextTick(solve,[],this);
},function(data){
  console.log('Received asynchronously:',data);
});

if(result != resolve.deferred) console.log('Received synchronously:',result);

Reference

resolve(function,arguments,callback,thisArg)

This function executes function with arguments or an empty array as arguments, and a new Resolver as the thisArg. If Resolver.resolve is called within function, then this function returns the value passed to that call, otherwise it returns resolve.deferred, a unique object representing that the task could not be completed synchronously, and executes callback with thisArg as thisArg when Resolver.resolve is called.

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago