Socket
Socket
Sign inDemoInstall

rotorjs

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rotorjs

Component-based JavaScript library for single-page applications.


Version published
Weekly downloads
8
increased by300%
Maintainers
1
Weekly downloads
 
Created
Source

RotorJS

This is a beta-stage component-based JavaScript library for single-page applications and an example application.

npm version

Installation

npm install rotorjs

(Note: Node JS 14+ as an ECMAScript 2015+ & ESM-compatible environment is required.)

Philosophy

RotorJS provides classes which represent an application and its components.

It uses exchangeble "middlewares" under the hood. A middleware consist of a model class, a rendering loop class and (possible) other classes. You can use your own middlewares so RotorJS is DOM-agnostic, model-agnostic, etc.

A component is a subclass of RotorJS class, it has to provide a render function. Component's state (model) is available during render. Components may also have their activating and deactivating hooks. Subcomponents are supported.

Application is also a subclass of a RotorJS class. You may implement application's start and stop hooks but default start hook receives a root component.

A target object (e.g. DOM tree) is available after application has been started. It is changed during some component's state updating. So target is "current view" of application.

Some additional features are also provided.

Approaches

  • minimalism,
  • modularity,
  • testability,
  • (not yet) documentability,
  • isomorphism,
  • ECMAScript 2015 & ESM.

Default middleware

Default middleware is based on Freezer and Snabbdom. So your application uses unidirectional dataflow, immutable state and provides DOM target with default middleware.

You simple have to append application's target to your document's body and use Snabbdom's helpers to construct component's view. See example for more information.

Getting started

TODO

Example

See https://github.com/kuraga/rotorjs/tree/master/example.

How to test?

npm run test-browser
open test/browser/testBrowser.html
# read browser's console
npm run test-browser-clean

See also

Author

Alexander Kurakin <kuraga333@mail.ru>

Inspired by

Feedback and contribute

https://github.com/kuraga/rotorjs/issues

License

MIT

Keywords

FAQs

Package last updated on 26 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc