Sha256: d7b7d24011ec33945105db735204ef031b80194575ccf77aa87c139e9f52e0c8

Contents?: true

Size: 503 Bytes

Versions: 22

Compression:

Stored size: 503 Bytes

Contents

import { getData } from "@helpers/alpine";
import { nameFunction } from "@helpers/lang";

function CocoComponent(name, fn) {
  const func = nameFunction(name, (...args) => {
    const data = fn(...args);

    Object.defineProperties(data, {
      $parent: {
        get() {
          return getData(this.$root.parentElement);
        },
      },
    });

    data.$options = {};

    return data;
  });

  func.component = true;
  return func;
}

export default CocoComponent;
export { CocoComponent };

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
coveragebook_components-0.19.8 app/assets/js/coco/component.js
coveragebook_components-0.19.7 app/assets/js/coco/component.js
coveragebook_components-0.19.6 app/assets/js/coco/component.js
coveragebook_components-0.19.5 app/assets/js/coco/component.js
coveragebook_components-0.19.4 app/assets/js/coco/component.js
coveragebook_components-0.19.3 app/assets/js/coco/component.js
coveragebook_components-0.19.2 app/assets/js/coco/component.js
coveragebook_components-0.19.1 app/assets/js/coco/component.js
coveragebook_components-0.19.0 app/assets/js/coco/component.js
coveragebook_components-0.18.8 app/assets/js/coco/component.js
coveragebook_components-0.18.7 app/assets/js/coco/component.js
coveragebook_components-0.18.0 app/assets/js/coco/component.js
coveragebook_components-0.17.7 app/assets/js/coco/component.js
coveragebook_components-0.17.6 app/assets/js/coco/component.js
coveragebook_components-0.17.5 app/assets/js/coco/component.js
coveragebook_components-0.17.4 app/assets/js/coco/component.js
coveragebook_components-0.17.3 app/assets/js/coco/component.js
coveragebook_components-0.17.2 app/assets/js/coco/component.js
coveragebook_components-0.17.1 app/assets/js/coco/component.js
coveragebook_components-0.17.0 app/assets/js/coco/component.js