Options
All
  • Public
  • Public/Protected
  • All
Menu

Directly-instantiable extension subject for singleton extensions.

see

ExtensionSubject

Type parameters

Hierarchy

Index

Constructors

constructor

Properties

Static Protected factoryProps

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

Accessors

Protected factory

  • get factory(): { construct?: undefined | {}; err?: any }
  • Returns { construct?: undefined | {}; err?: any }

    • Optional construct?: undefined | {}
    • Optional err?: any

      ERR_MODULE_NOT_FOUND or any constructor errors

singleton

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

Methods

Protected invalidate

  • invalidate(): void

onPropertiesUpdated

Protected onPropertyUpdated

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

Static declare

  • declare(id: Iri | undefined, moduleId: string, 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
    • moduleId: string

      the CommonJS module (must be accessible using require)

    • 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
  • Static property
  • Static method
  • Inherited property
  • Protected method

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