Options
All
  • Public
  • Public/Protected
  • All
Menu

A class that provides a way to easily persist multiple objects at the same time without multiple calls to host.persistProperties

Hierarchy

  • PropertyPersister

Index

Constructors

Properties

Methods

Constructors

constructor

  • new PropertyPersister(host: IVisualHostServices, delay?: number): PropertyPersister

Properties

Private delay

delay: number

Private host

host: IVisualHostServices

Private propUpdater

propUpdater: any = _.debounce(() => {if (this.propsToUpdate && this.propsToUpdate.length) {const toUpdate = this.propsToUpdate.slice(0);this.propsToUpdate.length = 0;const final: powerbi.VisualObjectInstancesToPersist = {};let isSelection: boolean;toUpdate.forEach(n => {n.changes.forEach(m => {Object.keys(m).forEach(operation => {if (!final[operation]) {final[operation] = [];}final[operation].push(...m[operation]);});});if (n.selection) {isSelection = true;}});// SUPER important that these guys happen together, otherwise the selection does not update properlyif (isSelection) {this.host.onSelect({ data: [] } as any); // TODO: Change this to visualObjects: []?}this.host.persistProperties(final);}}, this.delay)

Private propsToUpdate

propsToUpdate: object[] = []

Queues the given property changes

Type declaration

  • changes: VisualObjectInstancesToPersist[]
  • selection: boolean

Methods

persist

  • persist(selection: boolean, ...changes: VisualObjectInstancesToPersist[]): void
  • Queues a set of property changes for the next update

    Parameters

    • selection: boolean

      True if the properties contains selection

    • Rest ...changes: VisualObjectInstancesToPersist[]

    Returns void

Generated using TypeDoc