How to access attributes in a strongly-typed manner

Only added comments and examples
This commit is contained in:
Omid K. Rad
2014-07-16 16:12:00 -07:00
parent c743233ab0
commit 06392eab94

View File

@@ -113,8 +113,23 @@ declare module Backbone {
fetch(options?: ModelFetchOptions): JQueryXHR;
get(attributeName: string): any;
set(attributeName: string, value: any, options?: ModelSetOptions): Model;
/**
* For strongly-typed access to attributes, use the `get` method only privately in public getter properties.
* @example
* get name(): string {
* return super.get("name");
* }
**/
/*private*/ get(attributeName: string): any;
/**
* For strongly-typed assignment of attributes, use the `set` method only privately in public setter properties.
* @example
* set name(value: string) {
* super.set("name", value);
* }
**/
/*private*/ set(attributeName: string, value: any, options?: ModelSetOptions): Model;
set(obj: any, options?: ModelSetOptions): Model;
change(): any;