Sha256: 027fef11b8bb6e8534787d73f32255bf7136a7d9517477e91305689d494a4411

Contents?: true

Size: 537 Bytes

Versions: 2

Compression:

Stored size: 537 Bytes

Contents

export default function param() {
  return {
    focused: false,
    setFocus() {
      if (this.focused && this.$el.focus) {
        this.$el.focus();
      }
    },
    update(name, value) {
      const searchParams = new URLSearchParams(window.location.search);
      searchParams.set(name, value);
      const path = location.href.replace(location.search, "");
      this.navigateTo(`${path}?${searchParams.toString()}`);
    },
    validate() {
      return this.$el.reportValidity ? this.$el.reportValidity() : true;
    },
  };
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lookbook-0.4.6 app/assets/lookbook/js/workbench/param.js
lookbook-0.4.5 app/assets/lookbook/js/workbench/param.js