mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-21 00:23:00 +08:00
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:
parent
029a8c88ec
commit
28d7d5ceec
@ -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