Last active
November 18, 2016 15:40
-
-
Save robophil/d13379d23c77bd7a04f40cab92adfb3b to your computer and use it in GitHub Desktop.
An implementation of nativescript Observable with a toJson method
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class Observable_ extends Observable { | |
private _json: Object = {}; | |
constructor(key: string, args: Object) { | |
super(args); | |
this._json = (args != null && typeof args === 'object') ? args : {};//initialize object | |
} | |
public set(name: string, value: any) { | |
this._json[name] = value; | |
super.set(name, value); | |
} | |
public toJson() { | |
return this._json; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment