1.0.2 • Published 2 years ago

ts-reactx v1.0.2

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 years ago

ts-reactx CI Status npm version Package Pipeline

A basic reactive system in TypeScript.

Reactive programming is a programming paradigm that focuses on how values are computed in terms of each other to allow a change to one value to automatically propagate to other values, like in a spreadsheet.

This system implements a basic reactive system with cells with settable values ("input" cells) and cells with values computed in terms of other cells ("compute" cells). It has a provision for "updates" so that when an input value is changed, values propagate to reach a new stable system state.

In addition, compute cells allow for registering change notification callbacks. A cell’s callbacks is called when the cell’s value in a new stable state has changed from the previous stable state.

References

Disclaimer

Usage

import Cell from './react'

let cell: Cell<number> = new Cell(1); // set a cell with value 1
const output = cell.getComputedCellFn(() => cell.readFn() + 1); // add a compute function
let result = output(); // result = 2

More examples in tests

ababacornacorn-globalsacorn-walkagent-baseansi-escapesansi-regexansi-stylesanymatchargparsearr-diffarr-flattenarr-unionarray-uniqueassign-symbolsasynckitatobbabel-plugin-dynamic-import-nodebabel-plugin-istanbulbabel-plugin-jest-hoistbabel-plugin-polyfill-corejs2babel-plugin-polyfill-corejs3babel-plugin-polyfill-regeneratorbabel-preset-current-node-syntaxbabel-preset-jestbalanced-matchbasebrace-expansionbracesbrowser-process-hrtimebrowserslistbserbuffer-fromcache-basecall-bindcallsitescamelcasecaniuse-litecapture-exitchalkchar-regexci-infocjs-module-lexerclass-utilscliuicocollect-v8-coveragecollection-visitcolor-convertcolor-namecolorettecombined-streamcomponent-emitterconcat-mapconvert-source-mapcopy-descriptorcore-js-compatcross-spawncssomcssstyledata-urlsdebugdecamelizedecimal.jsdecode-uri-componentdeep-isdeepmergedefine-propertiesdefine-propertydelayed-streamdetect-newlinediff-sequencesdomexceptionelectron-to-chromiumemitteryemoji-regexend-of-streamerror-exescaladeescape-string-regexpescodegenesprimaesutilsexec-shexecaexitexpand-bracketsexpectextend-shallowextglobfast-json-stable-stringifyfast-levenshteinfb-watchmanfill-rangefind-upfor-inform-datafragment-cachefs.realpathfunction-bindgensyncget-caller-fileget-intrinsicget-package-typeget-streamget-valueglobglobalsgraceful-fsgrowlyhashas-flaghas-symbolshas-valuehas-valueshosted-git-infohtml-encoding-snifferhtml-escaperhttp-proxy-agenthttps-proxy-agenthuman-signalsiconv-liteimport-localimurmurhashinflightinheritsis-accessor-descriptoris-arrayishis-bufferis-ciis-core-moduleis-data-descriptoris-descriptoris-dockeris-extendableis-fullwidth-code-pointis-generator-fnis-numberis-plain-objectis-potential-custom-element-nameis-streamis-typedarrayis-windowsis-wslisarrayisexeisobjectistanbul-lib-coverageistanbul-lib-instrumentistanbul-lib-reportistanbul-lib-source-mapsistanbul-reportsjest-changed-filesjest-clijest-configjest-diffjest-docblockjest-eachjest-environment-jsdomjest-environment-nodejest-get-typejest-haste-mapjest-jasmine2jest-leak-detectorjest-matcher-utilsjest-message-utiljest-mockjest-pnp-resolverjest-regex-utiljest-resolvejest-resolve-dependenciesjest-runnerjest-runtimejest-serializerjest-snapshotjest-utiljest-validatejest-watcherjest-workerjs-tokensjs-yamljsdomjsescjson-parse-even-better-errorsjson5kind-ofkleurlevenlines-and-columnslocate-pathlodashlodash.debouncelru-cachemake-dirmakeerrormap-cachemap-visitmerge-streammicromatchmime-dbmime-typesmimic-fnminimatchminimistmixin-deepmsnanomatchnatural-comparenice-trynode-int64node-modules-regexpnode-notifiernode-releasesnormalize-package-datanormalize-pathnpm-run-pathnwsapiobject-copyobject-keysobject-visitobject.assignobject.pickonceonetimep-each-seriesp-finallyp-limitp-locatep-tryparse5pascalcasepath-existspath-is-absolutepath-keypath-parsepicomatchpiratesposix-character-classespretty-formatpromptspslpumppunycodereact-isregenerateregenerate-unicode-propertiesregenerator-runtimeregenerator-transformregex-notregexpu-coreregjsgenregjsparserremove-trailing-separatorrepeat-elementrepeat-stringrequire-directoryrequire-main-filenameresolveresolve-cwdresolve-fromresolve-urlretrimrafrsvpsafe-buffersafe-regexsafer-buffersanesaxessemverset-blockingset-valueshebang-commandshebang-regexshellwordssignal-exitsisteransislashsnapdragonsnapdragon-nodesnapdragon-utilsource-mapsource-map-resolvesource-map-supportsource-map-urlspdx-correctspdx-exceptionsspdx-expression-parsespdx-license-idssplit-stringsprintf-jsstack-utilsstatic-extendstring-lengthstring-widthstrip-ansistrip-bomstrip-eofstrip-final-newlinesupports-colorsupports-hyperlinkssymbol-treeterminal-linktest-excludethroattmplto-fast-propertiesto-object-pathto-regexto-regex-rangetough-cookietr46type-detecttype-festtypedarray-to-bufferunicode-canonical-property-names-ecmascriptunicode-match-property-ecmascriptunicode-match-property-value-ecmascriptunicode-property-aliases-ecmascriptunion-valueuniversalifyunset-valueurixuseuuidv8-to-istanbulvalidate-npm-package-licensew3c-hr-timew3c-xmlserializerwalkerwebidl-conversionswhatwg-encodingwhatwg-mimetypewhatwg-urlwhichwhich-moduleword-wrapwrap-ansiwrappywrite-file-atomicwsxml-name-validatorxmlcharsy18nyallistyargsyargs-parser
1.0.2

2 years ago

1.0.1

3 years ago

1.0.0

3 years ago