New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to teardown a module instantiated with `Elm.embed` #432

Closed
TehShrike opened this Issue Nov 15, 2015 · 2 comments

Comments

Projects
None yet
2 participants
@TehShrike

TehShrike commented Nov 15, 2015

I couldn't find anything in the documentation or source code.

When I need to remove a component, how am I supposed to stop it?

I don't want to have to delete the element, just clear it.

Would deleting the element from the DOM even get the job done? Would the garbage collector be able to clean up the Elm code?

@danneu

This comment has been minimized.

Show comment
Hide comment
@danneu

danneu Nov 28, 2015

Looks like fullscreen and embed return an object with three methods, one of them being .dispose().

Source: elm-core/Native/Runtime.js#L171-L175

function dispose() {
  removeListeners(listeners);
  inputs = [];
}

danneu commented Nov 28, 2015

Looks like fullscreen and embed return an object with three methods, one of them being .dispose().

Source: elm-core/Native/Runtime.js#L171-L175

function dispose() {
  removeListeners(listeners);
  inputs = [];
}
@TehShrike

This comment has been minimized.

Show comment
Hide comment
@TehShrike

TehShrike Nov 28, 2015

This looks like what I was hoping for! I'll leave this open in case some other contributor wants to confirm, but I'll give dispose a try.

TehShrike commented Nov 28, 2015

This looks like what I was hoping for! I'll leave this open in case some other contributor wants to confirm, but I'll give dispose a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment