Skip to content
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

feat(Subscription): remove will now remove any teardown by reference #5659

Merged

Commits on Aug 20, 2020

  1. feat(Subscription): remove will now remove any teardown by reference

    Previously, only `Subscription` instances could be removed from a `Subscription`. Now any valid `TeardownLogic` that has been added to a `Subscription` may be removed by passing the same instance to `add`.
    
    For example:
    
    ```ts
    const teardown = () => console.log('called');
    
    const subscription = new Subscription();
    
    subscription.add(teardown);
    subscription.remove(teardown);
    subscription.unsubscribe();
    
    // Will log nothing
    ```
    
    Similarly with "unsubscribables":
    
    ```ts
    const unsubscribable = {
        unsubscribe() {
            console.log('called');
        }
    };
    
    const subscription = new Subscription();
    
    subscription.add(unsubscribable);
    subscription.remove(unsubscribable);
    subscription.unsubscribe();
    
    // Will log nothing
    ```
    
    - Cleans up and refactors Subscription substantially.
    - Adds a few additional tests around Subscription and checking for teardown registries and unregistries
    benlesh committed Aug 20, 2020
    Configuration menu
    Copy the full SHA
    937b4f8 View commit details
    Browse the repository at this point in the history
  2. refactor: Address comments

    - Addresses comments
    - Refines code a little further, moving some work closer to where it needs to be (teardowns array will no longer be allocated before we see if we even need to add anything, etc)
    - Rewrites conditionals in _addParent method.
    - Fixes test that didn't really test anything
    benlesh committed Aug 20, 2020
    Configuration menu
    Copy the full SHA
    c732c07 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    8c6d652 View commit details
    Browse the repository at this point in the history

Commits on Aug 21, 2020

  1. chore: address comments

    benlesh committed Aug 21, 2020
    Configuration menu
    Copy the full SHA
    dc5fc8a View commit details
    Browse the repository at this point in the history