Skip to content

Commit

Permalink
feat(plugin): add wrapper for instance properties
Browse files Browse the repository at this point in the history
this wrapper will be able to handle get/set functions for any instance property
  • Loading branch information
ihadeed committed Apr 30, 2016
1 parent 029a8c8 commit 28d7d5c
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/plugins/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 28d7d5c

Please sign in to comment.