Sha256: 021ddbbe6924443a49670e6344eedb26d64fe426da177fcc273afeeb362adfad

Contents?: true

Size: 823 Bytes

Versions: 2

Compression:

Stored size: 823 Bytes

Contents

import Alpine from "../base/alpine";
import packageJSON from "@/package.json" assert { type: "json" };
import { registerComponents } from "@helpers/alpine.js";
import CocoComponent from "./component";
import * as helpers from "@helpers/index";

const Coco = {
  version: packageJSON.version,

  start() {
    if (this._started) {
      throw new Error("Coco has already been started!");
    }

    console.info("Initializing Coco JS", packageJSON.version);

    registerComponents(this._components);

    window.Alpine = Alpine;
    Alpine.start();
  },

  registerComponents(components) {
    this._components.push(...components);
  },

  component(...args) {
    return CocoComponent(...args);
  },

  _components: [],

  _started: false,
};

Coco.Component = CocoComponent;
Coco.helpers = helpers;

export default Coco;

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
coveragebook_components-0.16.0 app/assets/js/coco/coco.js
coveragebook_components-0.15.0 app/assets/js/coco/coco.js