Skip to content

gr0uch/s2

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

test status

s2 is a function for reactive web UI.

See the documentation page for usage details.

Benchmarks

See js-framework-benchmark results table.

Flags

  • s2.shouldUnmountRoot: enabled by default, but can be disabled. This will automatically call unmount when the DOM nodes mapped to an object are removed. This should only be disabled if you need to keep updating nodes that may be removed and appended later.
  • s2.isDeferred (experimental): this will defer setting proxy values as a microtask. This might be preferable if there is significant blocking in between updates. However, it can break functionality in case there are updates that depend on a previous update in the same tick.
  • s2.window: set a different global object for server-side rendering.
  • s2.debug: turn on messages in the console. Warning: has a performance impact.

Development

s2 is written in the Parenscript subset of Common Lisp.

Need to build the psbuild binary from parenscript-builder and put it here to compile with make. I couldn't figure out how to automate including this dependency yet.

Testing

Run automated tests with Deno:

make && deno test test/

Manual testing pages

Run a web server like http-server . and then navigate to the /test/ directory. HTTP is required for loading modules.

Name

s2 is short for simulacra 2. Prior art: I wrote a similar library that is limited to ES5, so no proxies.

License

BSD 3-Clause