open-element-stack-mixin.js 838 B

1234567891011121314151617181920212223242526272829303132333435
  1. 'use strict';
  2. const Mixin = require('../../utils/mixin');
  3. class LocationInfoOpenElementStackMixin extends Mixin {
  4. constructor(stack, opts) {
  5. super(stack);
  6. this.onItemPop = opts.onItemPop;
  7. }
  8. _getOverriddenMethods(mxn, orig) {
  9. return {
  10. pop() {
  11. mxn.onItemPop(this.current);
  12. orig.pop.call(this);
  13. },
  14. popAllUpToHtmlElement() {
  15. for (let i = this.stackTop; i > 0; i--) {
  16. mxn.onItemPop(this.items[i]);
  17. }
  18. orig.popAllUpToHtmlElement.call(this);
  19. },
  20. remove(element) {
  21. mxn.onItemPop(this.current);
  22. orig.remove.call(this, element);
  23. }
  24. };
  25. }
  26. }
  27. module.exports = LocationInfoOpenElementStackMixin;