dot big bang

Developer API
Menu

Class ResourceRef<K, L, M>

All
  • Public
  • Public/Protected
  • All

Type parameters

  • K: ResourceType

  • L: InstanceType<ResourceClassFromType<K>>

  • M: InstanceType<ResourceClassFromType<K>> | null

Hierarchy

Index

Constructors

Accessors

Methods

Constructors

constructor

  • new ResourceRef<K, L, M>(resourceType: K, resource?: L): ResourceRef<K, L, M>

Accessors

id

  • get id(): string
  • Returns the id of the Resource this ResourceRef points to. If this ResourceRef not set to anything, the id is the empty string.

    Returns string

type

  • Returns the type of Resource that this ResourceRef can point to.

    Returns ResourceType

Methods

clone

  • Returns a new ResourceRef object that's a copy of this one. Note that what gets cloned here is just the ResourceRef object (i.e. the indirection to a Resource). The underlying Resource, if any, isn't duplicated/cloned.

    Returns ResourceRef<K, L, M>

copy

  • copy(resourceRef: ResourceRef<K, L, null | InstanceType<ResourceClassFromType<K>>>): ResourceRef<K, L, null | InstanceType<ResourceClassFromType<K>>>
  • Makes this ResourceRef a copy of the provided one.

    Parameters

    • resourceRef: ResourceRef<K, L, null | InstanceType<ResourceClassFromType<K>>>

    Returns ResourceRef<K, L, null | InstanceType<ResourceClassFromType<K>>>

exists

  • Returns true if this ResourceRef points to a Resource, false if it wasn't set to point to anything.

    Returns this is ResourceRef<K, L, L>

get

  • get(): M
  • Returns the Resource pointed to by this ResourceRef or null if it wasn't set.

    Returns M

set

  • set(resource: null | L): void
  • Sets this ResourceRef to point to the provided Resource. If it is set to null, this ResourceRef is cleared and won't point to anything.

    Parameters

    • resource: null | L

    Returns void