New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

flatq

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flatq

async for promise

latest
Source
npmnpm
Version
1.0.6
Version published
Maintainers
1
Created
Source

FlatQ

=========

like q/async

test case will coming soon... more function will coming soon...

用于实现异步的流程同步执行

Download

Check out [https://github.com/microlv/FlatQ.git]

for details over the differences between builds.

GitHub: https://github.com/microlv/FlatQ/ Wiki: http://microlv.github.io/FlatQ

Features

like q/async, but the code is simple and powerful and useful.

every function will inject a argument name 'defer', you can use it to resolve/reject. or detect the defer.err to see parent function has error or not.

Support

Chrome, Nodejs

Installation

npm install flatq --save

Usage

sample use:

$q(function (d) {
	setTimeout(function () {
		console.log('function 1');
		d.resolve('pass data to next function!');
		console.log('function 1 step 2');
	}, 0);
	console.log('function 1 step 1');
}).then(function (d, data) {
	console.log('function 2');
	console.log(data);
	d.reject();
}).then(function () {
	console.log('function 3,function2 resolve will go here');
}, function () {
	console.log('function 3 function2 reject will go here');
}).then(function () {
	console.log('function 4');
});

series:

$q.series([function(d){
	use resolve will make the series execute next task!
	d.resolve();

	//step pass data
	var passData={hello:'world'};
	d.resolve(passData)

	reject will make series stop.
	d.reject();

}],function(d,data){

	I can get the data from //step pass data
	console.log(data);
});

series example:

$q.series([
	function (d) {
		console.log('series 1');
		setTimeout(function () {
			d.resolve('series 2 finish!');
		}, 0);
	},
	function (d) {
		console.log('series 2');
		setTimeout(function () {
			d.resolve('series 2 finish!');
		}, 0);
	},
	function (d) {
		console.log('series 3');
		setTimeout(function () {
			d.resolve('series 3 finish!');
		}, 0);
	}
], function (d,result) {
	console.log('finish');
	d.resolve();
}).then(function (d) {
	console.log('then start');
});

Author

Andy.lv@live.com; Any problem contact with me.

Contributors

Keywords

q

FAQs

Package last updated on 14 Jan 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts