mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-21 00:23:00 +08:00
Merge pull request #150 from driftyco/instance-property
feat(plugin): add wrapper for instance properties
This commit is contained in:
commit
26dcff4db7
@ -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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user