Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/0xc0Der/xuijs

A javascript runtime library for creating reactive user interfaces.
https://github.com/0xc0Der/xuijs

library reactive runtime ui

Last synced: 3 months ago
JSON representation

A javascript runtime library for creating reactive user interfaces.

Awesome Lists containing this project

README

        

# Xuijs

A javascript runtime library for creating reactive user interfaces.

# features

Xuijs is a set of tools that makes it so easy to add reactivity to your UIs.

- no vdom
- very lightweight.
- very fast.
- unopinionated.
- extendable to infinity.

# usage

1. download the package using npm.

```bash

$ npm i xuijs

```

2. define the App.

```js
import { Xui } from 'xuijs';

const App = new Xui();

App.init(document.body);
```

3. define an element.

```js
// index.js

import { XuiElement, Variable } from 'xuijs';

export class Ticker extends XuiElement {
constructor(el) {
super(el);

this.ticks = new Variable(0);
this.state = new Variable(false);
}

getTicks(ticks) {
return `${ticks}`;
}

resetTicks() {
this.ticks.value = 0;
}

getState(state) {
return state ? 'stop' : 'start';
}

switchState() {
if (this.state.value) {
window.clearInterval(this.ticker);
} else {
this.ticker = window.setInterval(() => this.ticks.value++, 1000);
}

this.state.value = !this.state.value;
}
}
```

4. use the element.

```html


0


start

reset

```

5. bundle with your favourite bundeler.

# docs

see [docs/](https://github.com/0xc0Der/xuijs/tree/main/docs 'docs/') folder for more details.

# examples

see [examples/](https://github.com/0xc0Der/xuijs/tree/main/examples 'examples/') folder for example projects.