# sat-worker

> Библиотека для запуска фоновых процессов в библиотеках

Latest version **1.0.5** (published 2022-01-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install sat-worker
pnpm add sat-worker
yarn add sat-worker
bun add sat-worker
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2022-01-24 |
| First published | 2022-01-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 95.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Александр Желнин |
| Maintainers | kulibin_s |
| Keywords | web worker |

## Links

- npm: https://www.npmjs.com/package/sat-worker
- Repository: https://github.com/AlexanderZhelnin/angular-sat-auth-lib
- Homepage: https://www.youtube.com/channel/UCGntVzOD7faGCYbrUfd8PQg
- Issues: https://github.com/AlexanderZhelnin/angular-sat-auth-lib/issues
- npm.io page: https://npm.io/package/sat-worker

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^2.3.0

## Alternatives

- [cron](https://npm.io/package/cron.md) — 4.9M weekly downloads
- [@vercel/queue](https://npm.io/package/@vercel/queue.md) — 731.6K weekly downloads
- [create-sonicjs](https://npm.io/package/create-sonicjs.md) — 1.6K weekly downloads
- [@exellix/jobs-api](https://npm.io/package/@exellix/jobs-api.md) — 941 weekly downloads
- [@forwardimpact/libskill](https://npm.io/package/@forwardimpact/libskill.md) — 575 weekly downloads

## Recent versions

- 1.0.5 (latest) — 2022-01-24

## README

# SATWorker Библиотека запуска процесса в фоне. 

[Исходный код библиотеки](https://github.com/AlexanderZhelnin/angular-sat-worker-lib)

[![Видео](https://img.youtube.com/vi/8ZTWU62bFAM/0.jpg)](https://youtu.be/8ZTWU62bFAM)

####главный модуль
```ts
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BehaviorSubject } from 'rxjs';
import { ISATWorker, SATWORKER_OPTIONS } from 'sat-worker';

import { AppComponent } from './app.component';

@NgModule({
  declarations: [
    .....
  ],
  imports: [
    .....    
  ],
  providers: [
    .....
    // свойства фоновых процессов
    { provide: SATWORKER_OPTIONS, useValue: new BehaviorSubject<ISATWorker>({ isAsync: true }) }
    .....
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }
```

####Пример
```ts
constructor(private s_worker: SatWorkerService) { }

ngOnInit()
{
  const f = (a: string): string =>
  {
    console.log('work');

    const start = Date.now();
    while (Date.now() < start + 5000)
    {
    }
    return a.toUpperCase();
  };

  for (let i = 1; i < 10; i++)
    this.s_worker.work(f, `Проверка${i}`).subscribe({ next: v => console.log(v) });

  setTimeout(() =>
  {
    this.s_worker.work(f, 'Проверка_').subscribe({ next: v => console.log(v) });
  }, 6000);

}
```

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