https://github.com/defactosoftware/cell-js
Simple solution for binding Javascript to specific templates or side server components
https://github.com/defactosoftware/cell-js
Last synced: 8 months ago
JSON representation
Simple solution for binding Javascript to specific templates or side server components
- Host: GitHub
- URL: https://github.com/defactosoftware/cell-js
- Owner: DefactoSoftware
- License: mit
- Created: 2017-05-24T08:41:06.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-02-27T10:52:17.000Z (almost 6 years ago)
- Last Synced: 2024-11-02T10:08:22.981Z (about 1 year ago)
- Language: JavaScript
- Size: 214 KB
- Stars: 6
- Watchers: 11
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cell-js
Simple and lightweight solution for binding Javascript to specific templates or side server components.
We use this alongside [ex_cell](https://github.com/DefactoSoftware/ex_cell), an Elixir/Phoenix module for coupling Javascript, CSS, Javascript and Views.
## Installation
```
npm install @defacto/cell-js
```
or
```
yarn add @defacto/cell-js
```
## Usage
```js
import { Cell, Builder } from "cells-js";
class AvatarCell extends Cell {
initialize() {
this.element.addEventListener("click", this.onToggleOpenClass);
}
onToggleOpenClass = e => this.element.classList.toggle("open");
}
Builder.register(AvatarCell, "AvatarCell");
export default AvatarCell;
```
For a more complete implementation see [ex_cell](https://github.com/DefactoSoftware/ex_cell).