Merge pull request #150 from driftyco/instance-property

feat(plugin): add wrapper for instance properties
This commit is contained in:
Ibrahim Hadeed 2016-04-30 13:31:59 -04:00
commit 26dcff4db7

View File

@ -317,3 +317,22 @@ export function CordovaProperty(target: Function, key: string, descriptor: Typed
return descriptor;
}
/**
* @private
* @param target
* @param key
* @param descriptor
* @constructor
*/
export function InstanceProperty(target: Function, key: string, descriptor: TypedPropertyDescriptor<any>) {
descriptor.get = function() {
return this._objectInstance[key];
};
descriptor.get = function(...args: any[]) {
return this._objectInstance[key] = args[0];
};
return descriptor;
}