File: src/lib/UI/UI.js

Recommend this page to a friend!
  Classes of Dom Hastings  >  JS Webdav Client  >  src/lib/UI/UI.js  >  Download  
File: src/lib/UI/UI.js
Role: Class source
Content type: text/plain
Description: Class source
Class: JS Webdav Client
Access files of a Webdav server
Author: By
Last change:
Date: 1 month ago
Size: 908 bytes
 

Contents

Class file image Download
import DAV from '../DAV.js';
import EventObject from '../EventObject';
import Unimplemented from '../Unimplemented.js';

export default class UI extends EventObject {
  #container;
  #dav;
  #options;

  constructor(container, options = {}, dav = new DAV({
    bypassCheck: options.bypassCheck,
    sortDirectoriesFirst: options.sortDirectoriesFirst,
  })) {
    super();

    if (! (container instanceof HTMLElement)) {
      throw new TypeError(`Invalid container element: '${container}'.`);
    }

    this.#container = container;
    this.#dav       = dav;
    this.#options   = options;
  }

  get options() {
    // return a clone so these cannot be changed
    return {
      ...this.#options
    };
  }

  get dav() {
    return this.#dav;
  }

  get container() {
    return this.#container;
  }

  render() {
    throw new Unimplemented('\'render\' must be implemented in the child class.');
  }
}