Class Collection

Hierarchy

Index

Constructor methods

Properties

Methods

Constructor methods

constructor(models?: Array<TModel extends Backbone.Model>, options?: any): Collection

Parameters

  • models?: Array<TModel extends Backbone.Model> optional
  • options?: any optional

Returns

Collection

Properties

public collection: TModel in Backbone.Collection<TModel extends Model>

public length: number

public model: new() => TModel

constructor(): TModel in Backbone.Collection<TModel extends Model>

Returns

TModel in Backbone.Collection<TModel extends Model>

public models: Array<TModel extends Backbone.Model>

public url: any

Methods

private _onModelEvent(event: string, model: TModel in Backbone.Collection<TModel extends Model>, collection: Collection, options: any)

Parameters

  • event: string
  • model: TModel in Backbone.Collection<TModel extends Model>
  • collection: Collection
  • options: any

private _prepareModel(attrs?: any, options?: any): any

Parameters

  • attrs?: any optional
  • options?: any optional

Returns

any

private _removeReference(model: TModel in Backbone.Collection<TModel extends Model>)

Parameters

  • model: TModel in Backbone.Collection<TModel extends Model>

public add(model: TModel in Backbone.Collection<TModel extends Model>, options?: AddOptions): Collection

Parameters

  • model: TModel in Backbone.Collection<TModel extends Model>
  • options?: AddOptions optional

Returns

Collection

public add(models: Array<TModel extends Backbone.Model>, options?: AddOptions): Collection

Parameters

  • models: Array<TModel extends Backbone.Model>
  • options?: AddOptions optional

Returns

Collection

public all(iterator: (element: TModel, index: number) => boolean, context?: any): boolean

Parameters

  • iterator: (element: TModel, index: number) => boolean
  • context?: any optional

Returns

boolean

public any(iterator: (element: TModel, index: number) => boolean, context?: any): boolean

Parameters

  • iterator: (element: TModel, index: number) => boolean
  • context?: any optional

Returns

boolean

public at(index: number): TModel in Backbone.Collection<TModel extends Model>

Parameters

  • index: number

Returns

TModel in Backbone.Collection<TModel extends Model>

public bind(eventName: string, callback: Function, context?: any): any

Parameters

  • eventName: string
  • callback: Function
  • context?: any optional

Returns

any

public bind(eventName: string, callback: Function, context?: any): any

Parameters

  • eventName: string
  • callback: Function
  • context?: any optional

Returns

any

public chain(): any

Returns

any

public collect(iterator: (element: TModel, index: number, context?: any) => any[], context?: any): Array<any>

Parameters

  • iterator: (element: TModel, index: number, context?: any) => any[]
  • context?: any optional

Returns

Array<any>

public compact(): Array<TModel extends Backbone.Model>

Returns

Array<TModel extends Backbone.Model>

public comparator(element: TModel in Backbone.Collection<TModel extends Model>): number

Parameters

  • element: TModel in Backbone.Collection<TModel extends Model>

Returns

number

public comparator(compare: TModel in Backbone.Collection<TModel extends Model>, to?: TModel in Backbone.Collection<TModel extends Model>): number

Parameters

  • compare: TModel in Backbone.Collection<TModel extends Model>
  • to?: TModel in Backbone.Collection<TModel extends Model> optional

Returns

number

public contains(value: any): boolean

Parameters

  • value: any

Returns

boolean

public countBy(iterator: (element: TModel, index: number) => any): Dictionary

Parameters

  • iterator: (element: TModel, index: number) => any

Returns

Dictionary

public countBy(attribute: string): Dictionary

Parameters

  • attribute: string

Returns

Dictionary

public create(attributes: any, options?: ModelSaveOptions): TModel in Backbone.Collection<TModel extends Model>

Parameters

Returns

TModel in Backbone.Collection<TModel extends Model>

public detect(iterator: (item: any) => boolean, context?: any): any

Parameters

  • iterator: (item: any) => boolean
  • context?: any optional

Returns

any

public difference(model?: Array<TModel extends Backbone.Model>): Array<TModel extends Backbone.Model>

Parameters

  • model?: Array<TModel extends Backbone.Model> optional

Returns

Array<TModel extends Backbone.Model>

public drop(): TModel in Backbone.Collection<TModel extends Model>

Returns

TModel in Backbone.Collection<TModel extends Model>

public drop(n: number): Array<TModel extends Backbone.Model>

Parameters

  • n: number

Returns

Array<TModel extends Backbone.Model>

public each(iterator: (element: TModel, index: number, list?: any) => void, context?: any): any

Parameters

  • iterator: (element: TModel, index: number, list?: any) => void
  • context?: any optional

Returns

any

public every(iterator: (element: TModel, index: number) => boolean, context?: any): boolean

Parameters

  • iterator: (element: TModel, index: number) => boolean
  • context?: any optional

Returns

boolean

private static extend(properties: any, classProperties?: any): any

Do not use, prefer TypeScript's extend functionality.

Parameters

  • properties: any
  • classProperties?: any optional

Returns

any

public fetch(options?: CollectionFetchOptions): JQueryXHR

Parameters

Returns

JQueryXHR

public filter(iterator: (element: TModel, index: number) => boolean, context?: any): Array<TModel extends Backbone.Model>

Parameters

  • iterator: (element: TModel, index: number) => boolean
  • context?: any optional

Returns

Array<TModel extends Backbone.Model>

public find(iterator: (element: TModel, index: number) => boolean, context?: any): TModel in Backbone.Collection<TModel extends Model>

Parameters

  • iterator: (element: TModel, index: number) => boolean
  • context?: any optional

Returns

TModel in Backbone.Collection<TModel extends Model>

public findWhere(properties: any): TModel in Backbone.Collection<TModel extends Model>

Parameters

  • properties: any

Returns

TModel in Backbone.Collection<TModel extends Model>

public first(): TModel in Backbone.Collection<TModel extends Model>

Returns

TModel in Backbone.Collection<TModel extends Model>

public first(n: number): Array<TModel extends Backbone.Model>

Parameters

  • n: number

Returns

Array<TModel extends Backbone.Model>

public flatten(shallow?: boolean): Array<TModel extends Backbone.Model>

Parameters

  • shallow?: boolean optional

Returns

Array<TModel extends Backbone.Model>

public foldl(iterator: (memo: any, element: TModel, index: number) => any, initialMemo: any, context?: any): any

Parameters

  • iterator: (memo: any, element: TModel, index: number) => any
  • initialMemo: any
  • context?: any optional

Returns

any

public forEach(iterator: (element: TModel, index: number, list?: any) => void, context?: any): any

Parameters

  • iterator: (element: TModel, index: number, list?: any) => void
  • context?: any optional

Returns

any

public get(id: string): TModel in Backbone.Collection<TModel extends Model>

Parameters

  • id: string

Returns

TModel in Backbone.Collection<TModel extends Model>

public groupBy(iterator: (element: TModel, index: number) => string, context?: any): Dictionary

Parameters

  • iterator: (element: TModel, index: number) => string
  • context?: any optional

Returns

Dictionary

public groupBy(attribute: string, context?: any): Dictionary

Parameters

  • attribute: string
  • context?: any optional

Returns

Dictionary

public include(value: any): boolean

Parameters

  • value: any

Returns

boolean

public indexOf(element: TModel in Backbone.Collection<TModel extends Model>, isSorted?: boolean): number

Parameters

  • element: TModel in Backbone.Collection<TModel extends Model>
  • isSorted?: boolean optional

Returns

number

public initial(): TModel in Backbone.Collection<TModel extends Model>

Returns

TModel in Backbone.Collection<TModel extends Model>

public initial(n: number): Array<TModel extends Backbone.Model>

Parameters

  • n: number

Returns

Array<TModel extends Backbone.Model>

public inject(iterator: (memo: any, element: TModel, index: number) => any, initialMemo: any, context?: any): any

Parameters

  • iterator: (memo: any, element: TModel, index: number) => any
  • initialMemo: any
  • context?: any optional

Returns

any

public intersection(model?: Array<TModel extends Backbone.Model>): Array<TModel extends Backbone.Model>

Parameters

  • model?: Array<TModel extends Backbone.Model> optional

Returns

Array<TModel extends Backbone.Model>

public invoke(methodName: string, arguments?: Array<any>): any

Parameters

  • methodName: string
  • arguments?: Array<any> optional

Returns

any

public isEmpty(object: any): boolean

Parameters

  • object: any

Returns

boolean

public last(): TModel in Backbone.Collection<TModel extends Model>

Returns

TModel in Backbone.Collection<TModel extends Model>

public last(n: number): Array<TModel extends Backbone.Model>

Parameters

  • n: number

Returns

Array<TModel extends Backbone.Model>

public lastIndexOf(element: TModel in Backbone.Collection<TModel extends Model>, fromIndex?: number): number

Parameters

  • element: TModel in Backbone.Collection<TModel extends Model>
  • fromIndex?: number optional

Returns

number

public listenTo(object: any, events: string, callback: Function): any

Parameters

  • object: any
  • events: string
  • callback: Function

Returns

any

public listenTo(object: any, events: string, callback: Function): any

Parameters

  • object: any
  • events: string
  • callback: Function

Returns

any

public listenToOnce(object: any, events: string, callback: Function): any

Parameters

  • object: any
  • events: string
  • callback: Function

Returns

any

public listenToOnce(object: any, events: string, callback: Function): any

Parameters

  • object: any
  • events: string
  • callback: Function

Returns

any

public map(iterator: (element: TModel, index: number, context?: any) => any[], context?: any): Array<any>

Parameters

  • iterator: (element: TModel, index: number, context?: any) => any[]
  • context?: any optional

Returns

Array<any>

public max(iterator?: (element: TModel, index: number) => any, context?: any): TModel in Backbone.Collection<TModel extends Model>

Parameters

  • iterator?: (element: TModel, index: number) => any optional
  • context?: any optional

Returns

TModel in Backbone.Collection<TModel extends Model>

public min(iterator?: (element: TModel, index: number) => any, context?: any): TModel in Backbone.Collection<TModel extends Model>

Parameters

  • iterator?: (element: TModel, index: number) => any optional
  • context?: any optional

Returns

TModel in Backbone.Collection<TModel extends Model>

public object(values?: Array<any>): Array<any>

Parameters

  • values?: Array<any> optional

Returns

Array<any>

public off(eventName?: string, callback?: Function, context?: any): any

Parameters

  • eventName?: string optional
  • callback?: Function optional
  • context?: any optional

Returns

any

public off(eventName?: string, callback?: Function, context?: any): any

Parameters

  • eventName?: string optional
  • callback?: Function optional
  • context?: any optional

Returns

any

public on(eventName: string, callback?: Function, context?: any): any

Parameters

  • eventName: string
  • callback?: Function optional
  • context?: any optional

Returns

any

public on(eventName: string, callback?: Function, context?: any): any

Parameters

  • eventName: string
  • callback?: Function optional
  • context?: any optional

Returns

any

public once(events: string, callback: Function, context?: any): any

Parameters

  • events: string
  • callback: Function
  • context?: any optional

Returns

any

public once(events: string, callback: Function, context?: any): any

Parameters

  • events: string
  • callback: Function
  • context?: any optional

Returns

any

public parse(response: any, options?: any): any

Parameters

  • response: any
  • options?: any optional

Returns

any

public parse(response: any, options?: any): any

Parameters

  • response: any
  • options?: any optional

Returns

any

public pluck(attribute: string): Array<any>

Parameters

  • attribute: string

Returns

Array<any>

public pop(options?: Silenceable): TModel in Backbone.Collection<TModel extends Model>

Parameters

Returns

TModel in Backbone.Collection<TModel extends Model>

public push(model: TModel in Backbone.Collection<TModel extends Model>, options?: AddOptions): TModel in Backbone.Collection<TModel extends Model>

Parameters

  • model: TModel in Backbone.Collection<TModel extends Model>
  • options?: AddOptions optional

Returns

TModel in Backbone.Collection<TModel extends Model>

public range(stop: number, step?: number): any

Parameters

  • stop: number
  • step?: number optional

Returns

any

public range(start: number, stop: number, step?: number): any

Parameters

  • start: number
  • stop: number
  • step?: number optional

Returns

any

public reduce(iterator: (memo: any, element: TModel, index: number) => any, initialMemo: any, context?: any): any

Parameters

  • iterator: (memo: any, element: TModel, index: number) => any
  • initialMemo: any
  • context?: any optional

Returns

any

public reduceRight(iterator: (memo: any, element: TModel, index: number) => any, initialMemo: any, context?: any): Array<any>

Parameters

  • iterator: (memo: any, element: TModel, index: number) => any
  • initialMemo: any
  • context?: any optional

Returns

Array<any>

public reject(iterator: (element: TModel, index: number) => boolean, context?: any): Array<TModel extends Backbone.Model>

Parameters

  • iterator: (element: TModel, index: number) => boolean
  • context?: any optional

Returns

Array<TModel extends Backbone.Model>

public remove(model: TModel in Backbone.Collection<TModel extends Model>, options?: Silenceable): TModel in Backbone.Collection<TModel extends Model>

Parameters

  • model: TModel in Backbone.Collection<TModel extends Model>
  • options?: Silenceable optional

Returns

TModel in Backbone.Collection<TModel extends Model>

public remove(models: Array<TModel extends Backbone.Model>, options?: Silenceable): Array<TModel extends Backbone.Model>

Parameters

  • models: Array<TModel extends Backbone.Model>
  • options?: Silenceable optional

Returns

Array<TModel extends Backbone.Model>

public reset(models?: Array<TModel extends Backbone.Model>, options?: Silenceable): Array<TModel extends Backbone.Model>

Parameters

  • models?: Array<TModel extends Backbone.Model> optional
  • options?: Silenceable optional

Returns

Array<TModel extends Backbone.Model>

public rest(): TModel in Backbone.Collection<TModel extends Model>

Returns

TModel in Backbone.Collection<TModel extends Model>

public rest(n: number): Array<TModel extends Backbone.Model>

Parameters

  • n: number

Returns

Array<TModel extends Backbone.Model>

public select(iterator: any, context?: any): Array<any>

Parameters

  • iterator: any
  • context?: any optional

Returns

Array<any>

public set(models?: Array<TModel extends Backbone.Model>, options?: Silenceable): Array<TModel extends Backbone.Model>

Parameters

  • models?: Array<TModel extends Backbone.Model> optional
  • options?: Silenceable optional

Returns

Array<TModel extends Backbone.Model>

public shift(options?: Silenceable): TModel in Backbone.Collection<TModel extends Model>

Parameters

Returns

TModel in Backbone.Collection<TModel extends Model>

public shuffle(): Array<any>

Returns

Array<any>

public size(): number

Returns

number

public some(iterator: (element: TModel, index: number) => boolean, context?: any): boolean

Parameters

  • iterator: (element: TModel, index: number) => boolean
  • context?: any optional

Returns

boolean

public sort(options?: Silenceable): Collection

Parameters

Returns

Collection

public sortBy(iterator: (element: TModel, index: number) => number, context?: any): Array<TModel extends Backbone.Model>

Parameters

  • iterator: (element: TModel, index: number) => number
  • context?: any optional

Returns

Array<TModel extends Backbone.Model>

public sortBy(attribute: string, context?: any): Array<TModel extends Backbone.Model>

Parameters

  • attribute: string
  • context?: any optional

Returns

Array<TModel extends Backbone.Model>

public sortedIndex(element: TModel in Backbone.Collection<TModel extends Model>, iterator?: (element: TModel, index: number) => number): number

Parameters

  • element: TModel in Backbone.Collection<TModel extends Model>
  • iterator?: (element: TModel, index: number) => number optional

Returns

number

public stopListening(object?: any, events?: string, callback?: Function): any

Parameters

  • object?: any optional
  • events?: string optional
  • callback?: Function optional

Returns

any

public stopListening(object?: any, events?: string, callback?: Function): any

Parameters

  • object?: any optional
  • events?: string optional
  • callback?: Function optional

Returns

any

public sync(arg?: Array<any>): JQueryXHR

Parameters

  • arg?: Array<any> optional

Returns

JQueryXHR

public sync(arg?: Array<any>): JQueryXHR

Parameters

  • arg?: Array<any> optional

Returns

JQueryXHR

public tail(): TModel in Backbone.Collection<TModel extends Model>

Returns

TModel in Backbone.Collection<TModel extends Model>

public tail(n: number): Array<TModel extends Backbone.Model>

Parameters

  • n: number

Returns

Array<TModel extends Backbone.Model>

public toArray(): Array<any>

Returns

Array<any>

public toJSON(options?: any): any

Parameters

  • options?: any optional

Returns

any

public toJSON(options?: any): any

Parameters

  • options?: any optional

Returns

any

public trigger(eventName: string, args?: Array<any>): any

Parameters

  • eventName: string
  • args?: Array<any> optional

Returns

any

public trigger(eventName: string, args?: Array<any>): any

Parameters

  • eventName: string
  • args?: Array<any> optional

Returns

any

public unbind(eventName?: string, callback?: Function, context?: any): any

Parameters

  • eventName?: string optional
  • callback?: Function optional
  • context?: any optional

Returns

any

public unbind(eventName?: string, callback?: Function, context?: any): any

Parameters

  • eventName?: string optional
  • callback?: Function optional
  • context?: any optional

Returns

any

public union(model?: Array<TModel extends Backbone.Model>): Array<TModel extends Backbone.Model>

Parameters

  • model?: Array<TModel extends Backbone.Model> optional

Returns

Array<TModel extends Backbone.Model>

public uniq(isSorted?: boolean, iterator?: (element: TModel, index: number) => boolean): Array<TModel extends Backbone.Model>

Parameters

  • isSorted?: boolean optional
  • iterator?: (element: TModel, index: number) => boolean optional

Returns

Array<TModel extends Backbone.Model>

public unshift(model: TModel in Backbone.Collection<TModel extends Model>, options?: AddOptions): TModel in Backbone.Collection<TModel extends Model>

Parameters

  • model: TModel in Backbone.Collection<TModel extends Model>
  • options?: AddOptions optional

Returns

TModel in Backbone.Collection<TModel extends Model>

public where(properies: any): Array<TModel extends Backbone.Model>

Parameters

  • properies: any

Returns

Array<TModel extends Backbone.Model>

public without(values?: Array<any>): Array<TModel extends Backbone.Model>

Parameters

  • values?: Array<any> optional

Returns

Array<TModel extends Backbone.Model>

public zip(model?: Array<TModel extends Backbone.Model>): Array<TModel extends Backbone.Model>

Parameters

  • model?: Array<TModel extends Backbone.Model> optional

Returns

Array<TModel extends Backbone.Model>