feat(plugin): add wrapper for instance properties

this wrapper will be able to handle get/set functions for any instance property
This commit is contained in:
Ibrahim Hadeed 2016-04-30 13:31:10 -04:00
parent 029a8c88ec
commit 28d7d5ceec

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;
}