v7.3.0

Finalizable
Mixin
internal

This mixin provides an asynchronous completion mechanism. This allows a process to coordinate its async actions (such as Ajax requests or user interaction) with cleanup.

Consider a context tracking helper class, for example:

 class Context extends Base.mixin(Finalizable) {
     // ...

async finish() { this.owner.trigger('finish', { context : this });

// Wait for any scheduled finalizer to run... await this.finalize(); }

doFinalize() { this.destroy(); } }

When the finish event is processed, the receiver can register a promise for whatever processing it would like to perform:

 class Foo {
     onFinish({ context }) {
         context.finalizer = this.askUser(context);
     }

async askUser(context) { // } }
No results

Properties

Properties are getters/setters or publicly accessible variables on this class

Functions

Functions are methods available for calling on the class
    • This template method is called at the end of finalize. By default it calls destroy(), but can be replaced by the derived class. This can be useful if it is not the Finalizable instance that awaits the finalize method.

    • finalize( )
      ASYNC

      This method is called (typically by this instance or its owner) to cleanup this instance while possibly first waiting for the finalizer promise to settle. Once settled, the doFinalize method is called.

    Source path

    Core/mixin/Finalizable.js

    Contents