# bichi-waiter

> When you need a solution to execute many functions at ones, it helps you.

Latest version **1.1.0** (published 2017-05-01) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install bichi-waiter
pnpm add bichi-waiter
yarn add bichi-waiter
bun add bichi-waiter
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2017-05-01 |
| First published | 2017-03-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | bichi |
| Maintainers | bichi |
| Keywords | function, callback, utility, bind, async |

## Links

- npm: https://www.npmjs.com/package/bichi-waiter
- Repository: https://github.com/bichikim/waiter
- Homepage: https://github.com/bichikim/waiter#readme
- Issues: https://github.com/bichikim/waiter/issues
- npm.io page: https://npm.io/package/bichi-waiter

## Dependencies (1)

- [lodash](https://npm.io/package/lodash.md) ^4.17.4

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2017-05-01
- 1.0.20 — 2017-04-28
- 1.0.19 — 2017-04-28
- 1.0.18 — 2017-04-28
- 1.0.17 — 2017-04-28
- 1.0.16 — 2017-04-26
- 1.0.15 — 2017-04-26
- 1.0.14 — 2017-04-24
- 1.0.13 — 2017-04-24
- 1.0.12 — 2017-04-24
- 1.0.11 — 2017-04-21
- 1.0.10 — 2017-04-21
- 1.0.9 — 2017-04-17
- 1.0.8 — 2017-04-17
- 1.0.7 — 2017-04-17
- … 7 more at https://npm.io/package/bichi-waiter/versions

## README

# The Waiter 
## When you need a solution to execute many functions at ones, it helps you!

## Installation
Please use ^1.0.14
````bash
npm install --save bichi-waiter
````

## Use 
```javascript
import Waiter from 'bichi-waiter';
const waiter = new Waiter();
const callbacks = {
    sayHello: {
        callback(){
            return 'Hello'
        }
    },
    sayHelloOnes: {
        callback(){
            return 'Hello'
        },
        ones: true,
    },
    sayHelloWithOperateFalseOption: {
        callback(){
            //It won't say hello
            return 'Hello'
        },
    },
    sayHelloGlobalBind: {
        callback(){
            return `Hello ${this.name}`;
        },
    },
    sayHelloLocalBind: {
        callback(){
            return `Hello ${this.name_local}`;
        },
        bind: {
            name_local: 'foo_local'
        },
    },
    sayHelloGlobalArguments: {
        callback(name){
            return `Hello ${name}`
        },
    },
    sayHelloLoLocalArguments: {
        callback(name1, name2){
            return `hello ${name1}, ${name2}`
        },
        arguments:['Local argument 1', 'Local argument 2']
    },
    sayHelloExecuteBind: {
        callback(){
            return `Hello ${this.name}`
        },
    },
    sayHelloExecuteArguments: {
        callback(name){
            return `Hello ${name}`
        },
    },
    sayHelloExecuteAdditionalArguments: {
        callback(GlobalName, additionalName){
            return `Hello ${GlobalName}, ${additionalName}`
        },
    },
    sayHelloError: {
        callback(){
            throw new Error('Hello');
        },
    },
};

waiter.saveMany(callbacks);

//This is global bind
waiter.bind({
    name: 'Global bind'
});

waiter.arguments(['Global argument']);

const option = {
    sayHelloWithOperateFalseOption: {
        operate: false
    },
    sayHelloExecuteBind:{
        bind:{
            name : 'Execute bind'
        }
    },
    sayHelloExecuteArguments:{
        arguments:['Execute argument']
    },
    sayHelloExecuteAdditionalArguments:{
        additionalArguments :['Execute additional argument'],
    }
};

//only for executeAsync
const options = [
    //first execute
    option,
    //second execute...
    {
        sayHelloWithOperateFalseOption: {
            operate: true,
        },
        sayHelloExecuteBind: {
            bind: {
                name: 'Execute bind',
            },
        },
        sayHelloExecuteArguments: {
            arguments: ['Execute argument']
        },
        sayHelloExecuteAdditionalArguments: {
            additionalArguments: ['Execute additional argument'],
        },
    }
];

//synchrony
console.log(waiter.execute(option));

//asynchronously
//now you can use like this. ^1.0.17
 waiter.executeAsync(option)
     .then((result) => {
         window.console.log(result)
     })
     .catch((reason) => {
         window.console.log(reason);
         window.console.log(reason.name);
     });
 
//now you can use like this. ^1.0.21
waiter.executeAsync(options)
    .then((result) => {
        window.console.log(result)
    })
    .catch((reason) => {
        window.console.log(reason);
        window.console.log(reason.name);
    })
    .then((result) => {
    //next result ... and next...
        window.console.log(result)
    });
 
console.log('It will be shown before a result of executeAsync!');
```

---
_Source: https://npm.io/package/bichi-waiter · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
