Options
All
  • Public
  • Public/Protected
  • All
Menu

Extension subject for singleton extensions.

Note care must be taken not to expose this subject to updates before the delegate instance (the singleton) has had a chance to attach its source properties. Thus, constructing an instance of this class should always await ready, even if the delegate instance is not immediately required.

see

ExtensionSubject

experimental

Type parameters

Hierarchy

Index

Constructors

Protected constructor

Properties

Static @type

@type: JsProperty<unknown[], String> = new JsProperty('@type', JsType.for(Array, String))

Utility property definition for CommonJs require key

Static Protected factoryProps

factoryProps: SubjectProperty[] = ['moduleType', 'cjsModule', 'esmModule', 'className']

Accessors

Protected factory

  • get factory(): Promise<{}>

ready

  • get ready(): Promise<this>
  • Returns Promise<this>

singleton

  • get singleton(): Promise<T>
  • Returns Promise<T>

Methods

Protected instance

Protected invalidate

  • invalidate(): void

Protected newInstance

onPropertiesUpdated

Protected onPropertyUpdated

  • onPropertyUpdated(property: SubjectProperty, result: unknown | Promise<unknown>): void

Static declare

  • declare(id: Iri | undefined, requireId: string | undefined, importId: string | undefined, className: string, properties?: Subject): Subject
  • Extension subject declaration. Insert into the domain data to register a module export to be instantiated by an extension subject.

    For example (assuming a m-ld clone object):

    clone.write(ExtensionSubject.declare(
      'myCustomClass',
      'my-custom-module',
      'MyExtClass'
    ));
    

    Parameters

    • id: Iri | undefined
    • requireId: string | undefined

      the CommonJS module, must be accessible using require

    • importId: string | undefined

      the ECMAScript module, must be accessible using import

    • className: string

      the constructor name exported by the module

    • Optional properties: Subject

      additional properties

    Returns Subject

Static instance

  • Obtain an instance of a custom class declared in the data as the type of the given graph subject.

    throws

    TypeError if the given graph subject does not have an extension type

    Type parameters

    • T

    Parameters

    Returns Promise<T>

Legend

  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Static property
  • Static method
  • Protected method

Generated using TypeDoc. Delivered by Vercel. @m-ld/m-ld - v0.10.0 Source code licensed MIT. Privacy policy