Skip to content

API to properly dispose objects #545

@chancancode

Description

@chancancode

@ember/object should provide the following APIs:

function isDestroying(obj: object): boolean; // same as isDestroying on Ember.Object
function isDestroyed(obj: object): boolean; // same as isDestroyed on Ember.Object
function onBeforeDestroy<T extends object>(obj: T, callback: (obj: T) => void); // same as willDestroy() on Ember.Object
function destroy(obj: object): void; // same as destroy() on Ember.Object

This is required for objects that doesn't inherit from Ember.Object (e.g. Glimmer Components, other native classes) to participate in the destruction protocol (dispose of the "meta", etc).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions