import { $ } from "@acanto/core-dom";

/**
 * Component: <%= component.name %>
 *
 * The component will be initialised simply by calling the function 
 * `<%= component.className %>();` when you need.
 */
export default function <%= component.className %>() {

  console.log("<%= component.className %> mounted.");

  /**
   * Public API
   * 
   * A public API is required only if the component needs to be controlled from
   * outside, that often happens if the component is used asynchronously and it
   * is required if used in a route managed by barba.js.
   */
  return {
    /**
     * Destroy
     * 
     * If the component is used asynchronously, especially in a route managed
     * by barba.js you should implement a destroy method where you deregister
     * listeners and eventually stop background js execution of this component.
     * Otherwise you are free to delete this method.
     */
    destroy() {}
  };
}

/**
 * Initialise
 * 
 * You can auto initialise the component by simply uncomment the following line.
 * This is the typical usecase of a component used in a "normal" route (not
 * managed by barba.js) as you can be sure that in this scenario the DOM is
 * ready.
 */
// auto init:
// <%= component.className %>();

// auto init and exports singleton:
// const <%= component.instanceName %> = <%= component.className %>();
// export default <%= component.instanceName %>;
