view.js 604 B

123456789101112131415161718192021222324
  1. class view {
  2. constructor() {
  3. // Dependencies must be valid views which have been loaded by the controller
  4. this.dependencies = ['page'];
  5. this.render = this.render.bind(this);
  6. this.remove = this.remove.bind(this);
  7. }
  8. render() {
  9. window.jquery('#container').html(
  10. `<div class="example-container">Rendered some content</div>`
  11. );
  12. // Attach events here
  13. }
  14. remove() {
  15. // Remove events here
  16. window.jquery('#container').remove('.example-container');
  17. }
  18. }
  19. module.exports = new view;