mol_wire_lib_tmp
v1.0.493
Published
Auto wiring modules. It gives ability to:
Downloads
3
Maintainers
Keywords
Readme
$mol_wire
Auto wiring modules. It gives ability to:
- Make any state observable using only 1.5KB lib. $hyoo_crowd 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.
- 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
High level API
Decorators
- $mol_wire_solo - reactive memoizing solo property decorator
- $mol_wire_plex - reactive memoizing multiplexed property decorator
- $mol_wire_field - reactive memoizing field decorator
- $mol_wire_method - method decorator which run inside fiber
Proxies
- $mol_wire_sync - converts async API to sync
- $mol_wire_async - converts sync API to async
Functions
- $mol_wire_easing - transition atom value
- $mol_wire_probe - run code without state changes
- $mol_wire_solid - make current fiber immortal
Structures
- $mol_wire_set - reactive Set
- $mol_wire_dict - reactive Dictionary
- $mol_wire_dom - reactive DOM
Low level API
Debug
- $mol_wire_log - state changes logger
Pub/Sub
- $mol_wire_pub - tiny publisher
- $mol_wire_sub - generic subscriber interface
- $mol_wire_pub_sub - subscriber with retranslation support
$mol_wire_auto
- current tracking subscriber
Reactivity
- $mol_wire_fiber - abstract pausable task with (a)sync API
- $mol_wire_task - one-shot fiber
- $mol_wire_atom - repeatable fiber
- $mol_wire_cursor - subscription statuses
NPM Bundles
mol_wire_lib
Lib with all production ready $mol_wire modules.
npm install mol_wire_lib
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 ) }
}
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
Tiny lib to making any state observabe for other $mol_wire based libs.
npm install mol_wire_pub
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
Lib to make real DOM reactive.
npm install mol_wire_domm
import { $mol_wire_dom as reactivate } from 'mol_wire_dom'
reactivate( document.body )