Newer
Older
dmpopidor / lib / assets / javascripts / utils / domManipulator.js
@briley briley on 24 Aug 2017 445 bytes Added DomManipulator and ariatiseForm
import { isFunction } from './isType';

export default class DomManipulator {
  constructor(selector) {
    if (document) {
      document.addEventListener('DOMContentLoaded', () => {
        this.element = document.querySelector(selector);

        if (isFunction(this.callback)) {
          this.callback();
        }
      });
    }
  }
  onReady(callback) {
    this.callback = callback;
  }
  getElement() {
    return this.element;
  }
}