Add internal methods and mixins to Model and Collection.

This commit is contained in:
Natan Vivo
2013-06-22 11:25:42 -03:00
parent 08259b232b
commit d6c2d01c5c
+19
View File
@@ -123,6 +123,19 @@ declare module Backbone {
save(attributes?: any, options?: ModelSaveOptions);
unset(attribute: string, options?: Silenceable);
validate(attributes: any, options?: any): any;
_validate(attrs: any, options: any): boolean;
// mixins from underscore
keys(): string[];
values(): any[];
pairs(): any[];
invert(): any;
pick(keys: string[]): any;
pick(...keys: string[]): any;
omit(keys: string[]): any;
omit(...keys: string[]): any;
}
class Collection extends ModelBase {
@@ -158,6 +171,12 @@ declare module Backbone {
unshift(model: Model, options?: AddOptions);
where(properies: any): Model[];
_prepareModel(attrs?: any, options?: any): any;
_removeReference(model: Model): void;
_onModelEvent(event: string, model: Model, collection: Collection, options: any): void;
// mixins from underscore
all(iterator: (element: Model, index: number) => boolean, context?: any): boolean;
any(iterator: (element: Model, index: number) => boolean, context?: any): boolean;
collect(iterator: (element: Model, index: number, context?: any) => any[], context?: any): any[];