# async-threading

> Async javascript the way I like it.

Latest version **1.0.2** (published 2018-10-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install async-threading
pnpm add async-threading
yarn add async-threading
bun add async-threading
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2018-10-31 |
| First published | 2018-10-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Iain Moncrief |
| Maintainers | iainmoncrief |
| Keywords | javascript |

## Links

- npm: https://www.npmjs.com/package/async-threading
- Repository: https://github.com/Iainmon/Thread.js
- Homepage: https://github.com/Iainmon/Thread.js#readme
- Issues: https://github.com/Iainmon/Thread.js/issues
- npm.io page: https://npm.io/package/async-threading

## Recent versions

- 1.0.2 (latest) — 2018-10-31
- 1.0.1 — 2018-10-31
- 1.0.0 — 2018-10-31

## README

Thread.js
=========

Javascript async the way I like it.

## Installation

  `npm install async-threading`

## Usage

    let Thread = require('async-threading');

###- Tasks

Same scope as block:

    let callEverySecond = new Thread( () => {
        console.log(callEverySecond.fireTimes + ' seconds have passed.');
    }, 1000);
    
Anonymous scope:

    let callEverySecond = new Thread( function () {
        console.log(this.fireTimes + ' seconds have passed.');
    }, 1000);
    
  * Methods for task Threads
    * `.toggle()` Sets the Thread to the opposite state.
    * `.kill()` Stops and sets the Thread to `undefined`.
  
  
  These will be called ever `1000ms` (one second).
  
  - Warning: I do not recomend doing `new Thread` without assigning it to a variable, because you will not be able to `toggle` or `kill` it.
    
###- Delayed Asynchronous Statements and Functions

Asynchronous delayed statement:

    Thread.spawn( () => {
        console.log('1 second has passed.');
    }, 1000);
    
Anonymous asynchronous delayed function:

    Thread.spawn( function () {
        console.log('1 second has passed.');
    }, 1000);

These will execute `1000ms` (one second) after they are declared

###- Asynchronous Statements and Functions

Asynchronous statement:

    Thread.do( () => {
        console.log('Code has been executed asynchronously.');
    });
    
Anonymous asynchronous function:

    Thread.do( function () {
        console.log('Code has been executed asynchronously.');
    });

These will execute immediately and asynchronously once they are called.


## Contributing

Contributors are welcome!

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