Skip to content

Dom cleanup on destroy#3

Merged
ericdrowell merged 2 commits intoericdrowell:masterfrom
thecodedrift:dom_cleanup_on_destroy
Apr 7, 2019
Merged

Dom cleanup on destroy#3
ericdrowell merged 2 commits intoericdrowell:masterfrom
thecodedrift:dom_cleanup_on_destroy

Conversation

@thecodedrift
Copy link
Copy Markdown
Contributor

Currently, the destroy() method doesn't clean up any handlers attached to the document object. This both resolves that issue and keeps all listening centralized using the same addEventListener logic.

  • adds a property this.allListeners = [] to contain all registered DOM listeners
  • adds a method this.addListener(obj, on, fn) to centralize DOM listener registration
  • adds a method this.removeAllListeners() which removes every listener in the allListeners collection, invoked in destroy() before viewport.destroy()

@ericdrowell ericdrowell merged commit d666e4b into ericdrowell:master Apr 7, 2019
@thecodedrift thecodedrift deleted the dom_cleanup_on_destroy branch April 7, 2019 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants