Skip to content

Listeners are not removed beforeDestroy #24

@pbabey

Description

@pbabey

Hi, I remarked, that the listensers are not removed beforeDestroy. It leads to performance issue, when you load the component multiple times. I added some code to the vue-grid-layout.min.js for removing the listeners. Could you have a look at this? Thank's.

      created: function() {
                var a = this;
                a.resizeHandler = function(b, c, d, e, f, g) {
                    a.resizeEvent(b, c, d, e, f, g)
                }, a.dragEventHandler = function(b, c, d, e, f, g) {
                    a.dragEvent(b, c, d, e, f, g)
                }, i.$on("resizeEvent", a.resizeHandler), i.$on("dragEvent", a.dragEventHandler)
            },
          beforeDestroy: function() {
                var a = this;
                i.$off("resizeEvent", a.resizeHandler), i.$off("dragEvent", a.dragEventHandler), window.removeEventListener("resize", a.onWindowResize)
            },

            created: function() {
                var a = this,
                    b = this;
                a.updateWidthHandler = function(a) {
                    b.updateWidth(a)
                }, a.compactHandler = function(a) {
                    b.compact(a)
                }, f.$on("updateWidth", a.updateWidthHandler), f.$on("compact", a.compactHandler);
                var c = void 0 != document.dir ? document.dir : document.getElementsByTagName("html")[0].getAttribute("dir");
                this.rtl = "rtl" == c, f.$on("directionchange", function(b) {
                    var b = void 0 != document.dir ? document.dir : document.getElementsByTagName("html")[0].getAttribute("dir");
                    a.rtl = "rtl" == b, a.compact()
                })
            },
            beforeDestroy: function() {
                var a = this;
                f.$off("updateWidth", a.updateWidthHandler), f.$off("compact", a.compactHandler)
            },

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions