Class WaitingForIdentifiableAndCompletedTypeReferences<T>

The purpose of this class is to inform its listeners, when all given TypeReferences reached their specified initialization state (or a later state). After that, the listeners might be informed multiple times, if at least one of the TypeReferences was unresolved/invalid, but later on all TypeReferences are again in the desired state, and so on.

Type Parameters

Implements

Constructors

Properties

fulfilled: boolean = false

Remembers whether all TypeReferences are in the desired states (true) or not (false).

These listeners will be informed once, when all TypeReferences are in the desired state. If some of these TypeReferences are invalid (the listeners will not be informed about this) and later in the desired state again, the listeners will be informed again, and so on.

typesToIgnoreForCycles: Set<Type> = ...

This is required for cyclic type definitions: In case of two types A, B which use each other for their properties (e.g. class A {p: B} and class B {p: A}), the case easily occurs, that the types A and B (respectively their WaitingFor... instances) are waiting for each other and therefore waiting for each other. In order to solve these cycles, types which are part of such "dependency cycles" should be ignored during waiting, e.g. A should not waiting B and B should not wait for A. These types to ignore are stored in the following Set.

waitForRefsCompleted: undefined | TypeReference<T>[]

These TypeReferences must be in the state Completed, before the listeners are informed

waitForRefsIdentified: undefined | TypeReference<T>[]

These TypeReferences must be in the states Identifiable or Completed, before the listeners are informed

Methods

  • This method is called to inform about additional types which can be ignored during the waiting/resolving process. This helps to deal with cycles in type dependencies.

    Parameters

    • moreTypesToIgnore: Set<Type>

      might contain duplicates, which are filtered internally

    Returns void