question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Motivation

Components currently support the $init callback that fires when the element is generated for the first time. This enables construction logic such as enabling a specific behaviour, issuing an API call or, as outlined here, subscribing to an observable.

However, the lifetime of an element might come to an end, typically due to a user action (e.g., closing a widget which removes a bunch of elements). In this case, it becomes necessary to terminate all ongoing transactions created by this element, such as cancelling API calls or unsubscribing from an observable. Such logic typically resides in a destructor callback, which could be called $deinit.

What about adding such callback? Or what would be the alternatives?

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:11
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
ghostcommented, Jun 28, 2017

$destroy +1

3reactions
pirannacommented, Jun 25, 2017

I find $destroy nicer.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Destructors in C++ - GeeksforGeeks
What is a destructor? Destructor is an instance member function which is invoked automatically whenever an object is going to be destroyed.
Read more >
Destructors - cppreference.com
A destructor is a special member function that is called when the lifetime of an object ends. The purpose of the destructor is...
Read more >
Destructors (C++ only) - IBM
Destructors are usually used to deallocate memory and do other cleanup for a class object and its class members when the object is...
Read more >
Destructor Definition & Meaning - Merriam-Webster
The meaning of DESTRUCTOR is a furnace or oven for the burning of refuse : incinerator.
Read more >
Destructor - Wikipedia
Destructor (computer programming), in object-oriented programming, a method which is automatically invoked when an object is destroyed · Euronymous (1968–1993), ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found