Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PartManager

Hierarchy

  • PartManager

Implements

  • IDirtyable
  • IDisposable

Index

Type aliases

Static GlobalSubscription

GlobalSubscription: object

Type declaration

Static PartID

PartID: string

Constructors

constructor

  • new PartManager(__namedParameters: object): PartManager

Properties

OnDirty

OnDirty: Observable<void>

Private OnDirtySrc$

OnDirtySrc$: Subject<void> = new Subject<void>()

Private _isDirty

_isDirty: boolean = false

Private _isDisposed

_isDisposed: boolean = false

Private _nErrorParts

_nErrorParts: number = 0

bindings

bindings: BindingsProvider

Private factory

factory: PartFactory

Private globalChangeSubscription

globalChangeSubscription: Subscription

Private globals

globals: GlobalsService

Private optionsBags

optionsBags: Map<string, OptionsBag> = new Map<PartManager.PartID, OptionsBag>()

Private partEvaluations

partEvaluations: Map<string, object> = new Map<PartManager.PartID, PartEvaluationState>()

Private partMap

partMap: Map<string, Part> = new Map<PartManager.PartID, Part>()

Private partServices

partServices: PartServices

Private subscriptions

subscriptions: Map<string, object[]> = new Map<string, PartManager.GlobalSubscription[]>()

Accessors

hasErrorParts

  • get hasErrorParts(): boolean
  • A flag indicating whether the PartManager currently has any ErrorParts.

    readonly
    remarks

    This is set by #addPart and cleared by #clearParts or #removePart (if the part removed is the last error part).

    Returns boolean

isDirty

  • get isDirty(): boolean

isDisposed

  • get isDisposed(): boolean

Methods

__@iterator

  • __@iterator(): IterableIterator<[string, Part]>

addPart

  • addPart(partName: string, model?: PartSerializer.ISerializedPart): Promise<Part>
  • Parameters

    • partName: string
    • Optional model: PartSerializer.ISerializedPart

    Returns Promise<Part>

Private cancelPart

  • cancelPart(id: PartID): void
  • Cancels the part's running options and marks the part as canceled.

    Parameters

    Returns void

Private cancelPartEvaluations

  • cancelPartEvaluations(id: PartID): void
  • Iterates the bound options canceling their evaluations. This doesn't modify the part state.

    Parameters

    Returns void

clearParts

  • clearParts(): void
  • Remove all parts in the PartManager and reset the Manager's state.

    Returns void

dispose

  • dispose(): void

Private evaluateOptionForPart

  • evaluateOptionForPart(id: string, optionName: string, staleMetadata: PartOption, cancelToken: CancelToken<any>): Promise<object>
  • Evaluate the given option, and return whether it evaluated successfully.

    Parameters

    • id: string

      The ID of the part to evaluate

    • optionName: string

      The name of the option to evaluate

    • staleMetadata: PartOption

      The last known metadata for the option

    • cancelToken: CancelToken<any>

      Used to cancel the option evaluation

    Returns Promise<object>

    Promise indicating if the evaluation succeeded, errored or was canceled.

Private evaluateOptions

  • evaluateOptions(id: PartID): void
  • Evaluate the options of a part and then render. If nothing is stale this will render the part.

    Parameters

    Returns void

Private evaluateOrWaitForUser

  • evaluateOrWaitForUser(id: PartID, userRequest?: boolean): void

getBagById

  • getBagById(id: PartID): OptionsBag | null
  • This function is meant for editors that need external access to the options bag. User code should not call this function.

    Parameters

    Returns OptionsBag | null

Private getGlobalsForBinding

  • getGlobalsForBinding(optModel: PartOption): string[]

getPartById

  • getPartById(id: PartID): Part | null

Private handleOptionChanged

  • handleOptionChanged(id: string): Promise<void>

Private handleOptionFinished

  • handleOptionFinished(id: PartID, optionName: string, cancelToken: CancelToken<void>, result: object): void
  • Parameters

    • id: PartID
    • optionName: string
    • cancelToken: CancelToken<void>
    • result: object

    Returns void

Private handlePartFinished

  • handlePartFinished(id: string): void

Private initializePart

  • initializePart(id: PartID): Promise<void>

Private isOptionChangeAlwaysStalable

  • isOptionChangeAlwaysStalable(staleMetadata: PartOption, freshMetadata: PartOption): boolean
  • A helper method to check dirtiness.

    If a set of conditions are met, then the option must be considered stale. These are changes that would show up in the serialized model, such as unbound option changes or binding expression changes.

    Parameters

    • staleMetadata: PartOption
    • freshMetadata: PartOption

    Returns boolean

Private onPartDisposed

  • onPartDisposed(sender: Part): void

removePart

  • removePart(id: PartID): Part
  • removePart(part: Part): Part

Private renderPart

  • renderPart(id: PartID): Promise<void>

setClean

  • setClean(): void

Private setDirty

  • setDirty(): void

setOptionForPart

  • setOptionForPart(id: PartID, optionName: string, newBinding: Binding | JSONObject | null): void
  • Set the binding on an option and update the manager.

    remarks

    This function, like [getBagById], is not meant for user code. It is intended for UI editors to change the state of the bindings.

    Parameters

    • id: PartID
    • optionName: string
    • newBinding: Binding | JSONObject | null

    Returns void

Private setSubscriptions

  • setSubscriptions(id: PartID, optModel: PartOption): void

Private trySetOption

  • trySetOption(name: string, model: Binding | JSONObject | null, bag: OptionsBag, part: Part): void
  • Parameters

    • name: string
    • model: Binding | JSONObject | null
    • bag: OptionsBag
    • part: Part

    Returns void

Private unhookPartSubscriptions

  • unhookPartSubscriptions(id: PartID): void
  • Removes all global subscriptions for the given part. This is used when removing the part

    Parameters

    Returns void

Private unhookStaleSubscriptions

  • unhookStaleSubscriptions(id: PartID, optModel: PartOption): void

Generated using TypeDoc