UNPKG

vasille

Version:

The same framework which is designed to build bulletproof frontends (core library).

56 lines (55 loc) 1.78 kB
import { Reactive } from "../core/core.js"; import { Listener } from "./listener.js"; import { ListenableModel } from "./model.js"; /** * Model based on Array class * @extends Array * @implements ListenableModel */ export declare class ArrayModel<T> extends Array<T> implements ListenableModel<T, T> { listener: Listener<T, T>; /** * @param data {Array} input data * @param ctx lifetime context of model */ constructor(data?: Array<T> | number, ctx?: Reactive); /** * Calls `Array.fill` and notify about changes * @param value {*} value to fill with * @param start {?number} begin index * @param end {?number} end index */ fill(value: T, start?: number, end?: number): this; /** * Calls `Array.pop` and notify about changes * @return {*} removed value */ pop(): T | undefined; /** * Calls `Array.push` and notify about changes * @param items {...*} values to push * @return {number} new length of the array */ push(...items: Array<T>): number; /** * Calls `Array.shift` and notify about changed * @return {*} the shifted value */ shift(): T | undefined; /** * Calls `Array.splice` and notify about changed * @param start {number} start index * @param deleteCount {?number} delete count * @param items {...*} * @return {ArrayModel} a pointer to this */ splice(start: number, deleteCount?: number, ...items: Array<T>): ArrayModel<T>; /** * Calls Array.unshift and notify about changed * @param items {...*} values to insert * @return {number} the length after prepending */ unshift(...items: Array<T>): number; replace(at: number, with_: T): this; destroy(): void; }