Skip to content

Instantly share code, notes, and snippets.

@robophil
Last active November 18, 2016 15:40
Show Gist options
  • Save robophil/d13379d23c77bd7a04f40cab92adfb3b to your computer and use it in GitHub Desktop.
Save robophil/d13379d23c77bd7a04f40cab92adfb3b to your computer and use it in GitHub Desktop.
An implementation of nativescript Observable with a toJson method
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