Component.ts 977 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. var Component = Model.extend({
  2. el: null,
  3. setElement: function(el) {
  4. this.el = el;
  5. this.bindGlobalHandlers();
  6. this.renderSkeleton();
  7. this.set('isInDom', true);
  8. },
  9. removeElement: function() {
  10. this.unset('isInDom');
  11. this.unrenderSkeleton();
  12. this.unbindGlobalHandlers();
  13. this.el.remove();
  14. // NOTE: don't null-out this.el in case the View was destroyed within an API callback.
  15. // We don't null-out the View's other jQuery element references upon destroy,
  16. // so we shouldn't kill this.el either.
  17. },
  18. bindGlobalHandlers: function() {
  19. },
  20. unbindGlobalHandlers: function() {
  21. },
  22. /*
  23. NOTE: Can't have a `render` method. Read the deprecation notice in View::executeDateRender
  24. */
  25. // Renders the basic structure of the view before any content is rendered
  26. renderSkeleton: function() {
  27. // subclasses should implement
  28. },
  29. // Unrenders the basic structure of the view
  30. unrenderSkeleton: function() {
  31. // subclasses should implement
  32. }
  33. });