A collection of JS modules to meet basic needs for web clients.
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
Tissevert a74b0cc480 Fix persistent state bug preventing to run named sequences and bindings twice 3 недель назад
src/UnitJS Fix persistent state bug preventing to run named sequences and bindings twice 3 недель назад
.gitignore The output of the compilation shouldn't be versioned 1 год назад
CHANGELOG.md Make a SJW package out of UnitJS 8 месяцев назад
Makefile Make a SJW package out of UnitJS 8 месяцев назад
README.md Make a SJW package out of UnitJS 8 месяцев назад
unit.js.tpl Make a SJW package out of UnitJS 8 месяцев назад

README.md

UnitJS

UnitJS is a tiny Javascript framework to write web applications. It provides four essential modules to deal with asynchronous functions (technically, it's a monad obtained by currifying the CPS functions of Javascript like setTimeout), value caching, DOM manipulation and basic functional needs like composition or object projections.

Usage

With SJW

UnitJS comes as a SJW package. You can install it by copying the src/ directory of this repository to your package database by issuing the following command from the current directory :

$ cp -r src/ ~/.sjw/unitJS

Then, using unitJS in your projects is as simple as writing :

import * as Async from UnitJS.Async;

in any module if you want to use the Async module for instance and compile your code using the --include option of sjw with package unitJS :

$ sjw -I unitJS your/code/src -o your/code/main.js

Note that all modules have their path prefixed by a common UnitJS component and that SJW will only include the modules actually used in your code, not all of UnitJS.

As a standalone JS script

If you don't want to or can't use SJW, it's still possible to use UnitJS by generating a single script that can then be loaded from your web page like this :

<script src="/path/to/unit.js"></script>

The file unit.js can be easily generated with make, which actually just calls the unit.js.tpl script. Note that you can still generate custom «partial» versions of unit.js if you don't use all of it by overriding the SRC variable of the Makefile like so :

make SRC="src/UnitJS/Dom.js src/UnitJS/Cache.js"

or by manually calling ./unit.js.tpl with the files you want, like the Makefile does.