# mol_wire_lib_tmp

> Auto wiring modules. It gives ability to:

Latest version **1.0.493** (published 2023-02-25) · 0 weekly downloads

## Install

```sh
npm install mol_wire_lib_tmp
pnpm add mol_wire_lib_tmp
yarn add mol_wire_lib_tmp
bun add mol_wire_lib_tmp
```

## 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.493 |
| Published | 2023-02-25 |
| First published | 2023-02-24 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 1.4 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | zerkalica |
| Keywords | $mol_wire_lib, $mol_wire, $mol, $mol_wire_sub, $mol_wire_pub, $mol_fail, $mol_wire_cursor, $mol_wire_pub_sub, $mol_dev_format, $mol_dev, $mol_wire_fiber, $mol_after_frame, $mol_after, $mol_after_timeout, $mol_object2, $mol_ambient, $mol_owning, $mol_delegate, $mol_fail_hidden, $mol_type_writable, $mol_type, $mol_wire_task, $mol_compare_deep, $mol_compare, $mol_wire_atom, $mol_func_name, $mol_func, $mol_key, $mol_guid, $mol_wire_method, $mol_type_foot, $mol_type_tail, $mol_fail_log, $mol_fail_catch, $mol_wire_probe, $mol_wire_solid, $mol_wire_watch, $mol_wire_sync, $mol_wire_async, $mol_wire_race, $mol_wire_solo, $mol_wire_plex, $mol_wire_field, $mol_const, $mol_wire_easing, $mol_state_time, $mol_state, $mol_object, $mol_mem, $mol_wire_patch, $mol_wire_let, $mol_type_result, $mol_wire_set, $mol_wire_dict, $mol_wait_timeout, $mol_wait, $mol_promise, $mol_wire_log, $mol_log3, $mol_tree, $mol_term_color, $mol_term |

## Links

- npm: https://www.npmjs.com/package/mol_wire_lib_tmp
- npm.io page: https://npm.io/package/mol_wire_lib_tmp

## Alternatives

- [promise-throttle](https://npm.io/package/promise-throttle.md) — 44.2K weekly downloads
- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads

## Recent versions

- 1.0.493 (latest) — 2023-02-25
- 1.0.489 — 2023-02-24

## README

# $mol_wire

Auto wiring modules. It gives ability to:

- Make any state observable using only 1.5KB lib. [$hyoo_crowd](https://github.com/hyoo-ru/crowd.hyoo.ru) as example.
- Automatic dynamic track runtime value dependencies and optimize task execution order.
- Memoize calculations with automatic revalidation. Yes, it completely solves [the first of hard problem in computer science](https://www.karlton.org/2017/12/naming-things-hard/).
- Convert sync API to async and vice versa. Yes, it's a black magic of idempotence.
- Manage resources automatically with predictable deconstruction moment. Yes, we don't rely on garbage collector.
- Dramatically reduce source code size and increase reliability by implementing reactive architecture.

## Articles about

- [Main Aspects of Reactivity](https://github.com/nin-jin/slides/tree/master/reactivity#readme)
- [Designing an ideal reactivity system](https://github.com/nin-jin/HabHub/issues/48)
- [JS Proposal: Auto Wire](https://gist.github.com/nin-jin/6b9765fb9d0d50c2e1d37689008f5357)

## High level API

### Decorators

- [$mol_wire_solo](https://github.com/hyoo-ru/mam_mol/tree/master/wire/solo) - reactive memoizing solo property decorator
- [$mol_wire_plex](https://github.com/hyoo-ru/mam_mol/tree/master/wire/plex) - reactive memoizing multiplexed property decorator
- [$mol_wire_field](https://github.com/hyoo-ru/mam_mol/tree/master/wire/field) - reactive memoizing field decorator
- [$mol_wire_method](https://github.com/hyoo-ru/mam_mol/tree/master/wire/method) - method decorator which run inside fiber

### Proxies

- [$mol_wire_sync](https://github.com/hyoo-ru/mam_mol/tree/master/wire/sync) - converts async API to sync
- [$mol_wire_async](https://github.com/hyoo-ru/mam_mol/tree/master/wire/async) - converts sync API to async

### Functions

- [$mol_wire_easing](https://github.com/hyoo-ru/mam_mol/tree/master/wire/easing) - transition atom value
- [$mol_wire_probe](https://github.com/hyoo-ru/mam_mol/tree/master/wire/probe) - run code without state changes
- [$mol_wire_solid](https://github.com/hyoo-ru/mam_mol/tree/master/wire/solid) - make current fiber immortal

## Structures

- [$mol_wire_set](https://github.com/hyoo-ru/mam_mol/tree/master/wire/set) - reactive Set
- [$mol_wire_dict](https://github.com/hyoo-ru/mam_mol/tree/master/wire/dict) - reactive Dictionary
- [$mol_wire_dom](https://github.com/hyoo-ru/mam_mol/tree/master/wire/dom) - reactive DOM


## Low level API

### Debug

- [$mol_wire_log](https://github.com/hyoo-ru/mam_mol/tree/master/wire/log) - state changes logger

### Pub/Sub

- [$mol_wire_pub](https://github.com/hyoo-ru/mam_mol/tree/master/wire/pub) - tiny publisher
- [$mol_wire_sub](https://github.com/hyoo-ru/mam_mol/tree/master/wire/sub) - generic subscriber interface
- [$mol_wire_pub_sub](https://github.com/hyoo-ru/mam_mol/tree/master/wire/pub/sub) - subscriber with retranslation support
- `$mol_wire_auto` - current tracking subscriber

### Reactivity

- [$mol_wire_fiber](https://github.com/hyoo-ru/mam_mol/tree/master/wire/fiber) - abstract pausable task with (a)sync API
- [$mol_wire_task](https://github.com/hyoo-ru/mam_mol/tree/master/wire/task) - one-shot fiber
- [$mol_wire_atom](https://github.com/hyoo-ru/mam_mol/tree/master/wire/atom) - repeatable fiber
- [$mol_wire_cursor](https://github.com/hyoo-ru/mam_mol/tree/master/wire/cursor) - subscription statuses

## NPM Bundles

### [mol_wire_lib](https://github.com/hyoo-ru/mam_mol/tree/master/wire/lib)

Lib with all production ready $mol_wire modules.

```sh
npm install mol_wire_lib
```

7KB [![](https://badgen.net/bundlephobia/minzip/mol_wire_lib)](https://bundlephobia.com/package/mol_wire_lib)

```ts
import {
	$mol_wire_solo as solo,
	$mol_wire_plex as plex,
	$mol_wire_method as task,
} from 'mol_wire_lib'

class User {
	@solo age( next = 0 ) { return next }
	@plex finger_exists( id: string, next = true ) { return next }
	@task finger_cut( id: string ) { this.finger_exists( id, false ) }
}
```

```js
const {
	$mol_wire_solo as solo,
	$mol_wire_plex as plex,
	$mol_wire_method as task,
} = require( 'mol_wire_lib' )

class User {
	age( next = 0 ) { return next }
	finger_exists( id: string, next = true ) { return next }
	finger_cut( id: string ) { this.finger_exists( id, false ) }
}

solo( User.prototype, 'age' )
plex( User.prototype, 'finger_exists' )
task( User.prototype, 'finger_cut' )
```

### [mol_wire_pub](https://github.com/hyoo-ru/mam_mol/tree/master/wire/pub)

Tiny lib to making any state observabe for other $mol_wire based libs.

```sh
npm install mol_wire_pub
```

1.5KB [![](https://badgen.net/bundlephobia/minzip/mol_wire_pub)](https://bundlephobia.com/package/mol_wire_pub)

```ts
import { $mol_wire_pub as Publisher } from 'mol_wire_pub'

let counter = 0
const pub = new Publisher

export function state() {
	pub.promote()
	return counter
}

export function increase() {
	++ counter
	pub.emit()
}

export function decrease() {
	-- counter
	pub.emit()
}
```

### [mol_wire_dom](https://github.com/hyoo-ru/mam_mol/tree/master/wire/dom)

Lib to make real DOM reactive.

```sh
npm install mol_wire_domm
```

7.5KB [![](https://badgen.net/bundlephobia/minzip/mol_wire_dom)](https://bundlephobia.com/package/mol_wire_dom)

```ts
import { $mol_wire_dom as reactivate } from 'mol_wire_dom'

reactivate( document.body )
```

## Close alternatives

- [MobX](https://mobx.js.org/)
- [CellX](https://github.com/Riim/cellx)

### [Architectural comparison](https://github.com/nin-jin/slides/tree/master/reactivity#reactive-libraries)

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