All Projects → tasjs → Tas

tasjs / Tas

Licence: mit
Make it easy to develop large, complex Node.js app.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Tas

Emacs Async Await
Async/Await for Emacs
Stars: ✭ 47 (-63.28%)
Mutual labels:  async, promise
Promised Pipe
A ramda.pipe-like utility that handles promises internally with zero dependencies
Stars: ✭ 64 (-50%)
Mutual labels:  async, promise
Before After Hook
wrap methods with before/after hooks
Stars: ✭ 49 (-61.72%)
Mutual labels:  async, promise
Fritzbox.js
☎️ The leading AVM Fritz!Box API for NodeJS and JavaScript.
Stars: ✭ 36 (-71.87%)
Mutual labels:  async, promise
Datakernel
Alternative Java platform, built from the ground up - with its own async I/O core and DI. Ultra high-performance, simple and minimalistic - redefines server-side programming, web-development and highload!
Stars: ✭ 87 (-32.03%)
Mutual labels:  async, promise
Breeze
Javascript async flow control manager
Stars: ✭ 38 (-70.31%)
Mutual labels:  async, promise
Bach
Compose your async functions with elegance.
Stars: ✭ 117 (-8.59%)
Mutual labels:  async, promise
Then
🎬 Tame async code with battle-tested promises
Stars: ✭ 908 (+609.38%)
Mutual labels:  async, promise
Write
Write data to the file system, creating any intermediate directories if they don't already exist. Used by flat-cache and many others!
Stars: ✭ 68 (-46.87%)
Mutual labels:  async, promise
Emittery
Simple and modern async event emitter
Stars: ✭ 1,146 (+795.31%)
Mutual labels:  async, promise
Create Request
Apply interceptors to `fetch` and create a custom request function.
Stars: ✭ 34 (-73.44%)
Mutual labels:  async, promise
Tedis
redis client with typescript and esnext for nodejs
Stars: ✭ 109 (-14.84%)
Mutual labels:  async, promise
Nodespider
[DEPRECATED] Simple, flexible, delightful web crawler/spider package
Stars: ✭ 33 (-74.22%)
Mutual labels:  async, promise
Node Qiniu Sdk
七牛云SDK,使用 ES2017 async functions 来操作七牛云,接口名称与官方接口对应,轻松上手,文档齐全
Stars: ✭ 44 (-65.62%)
Mutual labels:  async, promise
Vue Loadable
⏳ Improve your loading state control with pretty simple methods and helpers.
Stars: ✭ 23 (-82.03%)
Mutual labels:  async, promise
Download
Download and extract files
Stars: ✭ 1,064 (+731.25%)
Mutual labels:  async, promise
Wx Promise Pro
✨强大、优雅的微信小程序异步库🚀
Stars: ✭ 762 (+495.31%)
Mutual labels:  async, promise
Ws Promise Client
PROJECT MOVED: https://github.com/kdex/ws-promise
Stars: ✭ 6 (-95.31%)
Mutual labels:  async, promise
Flowa
🔥Service level control flow for Node.js
Stars: ✭ 66 (-48.44%)
Mutual labels:  async, promise
Taskorama
⚙ A Task/Future data type for JavaScript
Stars: ✭ 90 (-29.69%)
Mutual labels:  async, promise


Linux Build Status Windows Build Status Coverage Status Version License

 

Make it easy to develop large, complex Node.js app. With Tas, we are free to combine async tasks and sync tasks, all of them are performed in the order we arranged, which greatly simplifies the development, and the code is clear, and easy to maintain. Tas means "tasks".

Most people use the nested callback approach for handling asynchronous Node.js operations, this lead to an untameable callback hell. Now, with Tas, there is no callback hell any more, and it is extremely easy for writing a lot of asynchronous code.

A blocking call can cause a significant reduction in performance. Now, with Tas, we can completely and easily use async api instead of blocking api in Node.js, which will make the overall performance of the app greatly improved.

 

Install

$ npm install tas --save

 

Test

Clone the Tas repo first:

$ git clone https://github.com/tasjs/tas.git
$ cd tas
$ npm install

Run the tests:

$ npm test

 

Demo

The results are as follows:

Try it:

$ cd /path/to/tas
$ node examples/demo/index.js

 

Quick Example

// Use .begin() at the beginning of main js file.
var tas = require('tas').begin();
var a;

var tasks = function(){
    
    // Put sync code before tas().
    // Or put them in tas() like doSomething() at below.
    a = 0;
    
    // Use tas() to join the task(s) into Tas queue.
    // Tas will perform it in the order we arranged 
    // instead of running it immediately.
    tas({
        doSomething: function(){
          
            a ++; // 1

            // Go to the next task
            tas.next();
        },

        waitAndContinue: function(){
            a ++; // 2

            // Simulate an async task
            setTimeout(function(){
                a ++; // 3

                // Go to the next task when this async task is done.
                tas.next(2);
            }, 1000);
        }
    });

    tas(function(a0){
        a += a0 ; // 5
        console.log(a); // 5

        // Use tas.end() at the ending of main js file.
        tas.end();
    });
};

tas(tasks);

 

Full Examples

See the examples/usage folder. Try to run index.js and index.test.js (if exists) in each sub folder.

 

API

See the examples/api folder. Try to run each file in each sub folder.

 

Task Stream

Usage Functions Example
tas.begin() Use it at the beginning of main js file. Example
tas() Add an async task(s) or a sync task(s) to task stream. Example
tas.next() Go to the next task. Use tas.pass() to improve performance. Example
tas.all() Add multiple async tasks and perform them concurrently. Example
tas.end() Use it at the ending of main js file. Example

 

Breaking Flow

Usage Functions Example
tas.abort() Abort the current task stream. Example
tas.break() Break the current tasks. Example

 

Log Tree

Usage Functions Example
tas.enableTree() Enable printing log tree. Example
tas.disableTree() Disable printing log tree. Example
tas.log() Print custom log with indent of log tree. Example
tas.load() Print log tree with header and footer in submodule. Example

 

Performance

Tas can performs more than 1 million async tasks per second. With Tas, we can write server app with clear structure and excellent performance in Node.js. See details

 

License

MIT

Copyright (c) 2017, Owen Luke

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].