Page

source

Constructors

new Page<T extends Model<string, T> = Model<string>>(context: Context, spec: PageSpec): Pagesource

Properties

alreadyDisposed: booleansource

readonlycontextId: stringsource

readonlyhash: PageHashsource

readonlymetadata: QueryReflectionMetadatasource

Metadata for all fields.

readonlyserialiseRow: Functionsource

readonlyspec: PageSpecsource

readonlyview: Handlesource

Methods

Static methods

staticgetPersistent<T extends Model<string, T>>(context: Context, spec: PageSpec): Handlesource

staticgetTemporary<T extends Model<string, T>>(context: Context, spec: PageSpec): Pagesource

Instance methods

[custom](): stringsource

assertNotDisposed(): voidsource

containsViewOffset(index: ViewOffset): booleansource

Whether or not the given view index is within the bounds of the page.

dispose(): voidsource

getMetadata(): Readonly<QueryReflectionMetadata>source

getRealSize(): numbersource

getRows(): T[]source

getSerialisedRecord(record: T): JsonValue[]source

Returns the serialised values for each row of the page.

getSerialisedRows(): JsonValue[][]source

Returns the serialised values for each row of the page.

handleInsert(entry: RowAndOffset): voidsource

Handles the insertion of a row into the view.

If the row being inserted is above the page, the view_length and page offset are updated.

If the row being inserted is below the page, only the view_length is updated.

Otherwise, delegates to handleInsertIntoPage.

handleInsertIntoPage(entry: RowAndOffset): voidsource

Handles the insertion of a row into the page, enqueuing a row insert event.

If the page was already full before the new row was inserted, a subsequent row removal event is also generated so as to maintain the correct size of the page.

handleRemove(entry: RowAndOffset, oldIndex: ViewOffset): voidsource

Handles the removal of a row from the view.

If the row being removed is above the page, the view_length and the offset are updated.

If the row being removed is below the page, only the view_length is updated.

Otherwise, delegates to handleRemoveFromPage.

handleRemoveFromPage(record: T, viewOffset: ViewOffset): voidsource

Handles the removal of a row from the page. Inserts a replacement row if one is available.

handleResetPending(): voidsource

handleUpdate(entry: RowAndOffset, viewOffset: ViewOffset): voidsource

Handles the update of the values of a row. The row may also move position.

If the row is moving on to the page from outside it, delegates to handleInsert.

If the row is moving off the page, delegates to handleRemove.

Otherwise, generates a row update event.

lastIndex(): ViewOffsetsource

Return the projected index of the last row of the page. This might not point to a real row. For example, if the view has 10 rows and the page has offset = 5 and count = 10, last_index will return 15 even though that is beyond the end of the view. This information can be used to determine whether or not the page is full.

toString(): stringsource

viewOffsetToPageOffset(viewIndex: number | ViewOffset): PageOffsetsource

Subtracts the offset of this page to turn an index of a row in the view into an index of a row in this page. Does not validate that the index is actually within this page.

Inherited methods

emit<K extends keyof PageEventMap<T>>(event: K, args: Parameters<PageEventMap<T>[K]>): Pagesource

inherited from Emitter.emit

off<K extends keyof PageEventMap<T>>(event: K, callback: PageEventMap<T>[K]): Pagesource

inherited from Emitter.off

offAll(callback: CatchAllCallback<PageEventMap<T>>): Pagesource

inherited from Emitter.offAll

on<K extends keyof PageEventMap<T>>(event: K, callback: PageEventMap<T>[K], __namedParameters: Object = {}): Pagesource

inherited from Emitter.on

onAll(callback: CatchAllCallback<PageEventMap<T>>, __namedParameters: Object = {}): Pagesource

inherited from Emitter.onAll

removeAllListeners(): Pagesource

inherited from Emitter.removeAllListeners

removeAllListenersForOwner(targetOwner: object): Pagesource

inherited from Emitter.removeAllListenersForOwner