Skip to content

ecmel/refable-light

Repository files navigation

Refable Light

Lighter version of Refable

Installation

npm install refable-light --save-dev

Application

Application is the main class for bootstrapping. Controllers are registered on an application instance. For registering glob of controllers please refer to your bundler's documentation.

import { Application } from "refable-light";
import Search from "./controllers/search";

const application = new Application();

application.register("search", Search);

application.run();

Controllers

Controllers are instances of classes that you register in your application. Each controller class inherits from the Controller base class.

<div data-controller="search"></div>
import { Controller } from "refable-light";

export default class extends Controller {
  created() {
    //
  }

  connected() {
    //
  }

  disconnected() {
    //
  }
}

Controller classes are templated so more specific elements can be used if needed.

import { Controller } from "refable-light";

export default class extends Controller<HTMLElement> {
  //
}