Property.ts 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. module INSPECTOR {
  2. /**
  3. * A property is a link between a data (string) and an object.
  4. */
  5. export class Property {
  6. /** The property name */
  7. private _property : string;
  8. /** The obj this property refers to */
  9. private _obj : any;
  10. constructor(prop:string, obj:any) {
  11. this._property = prop;
  12. this._obj = obj;
  13. }
  14. public get name() : string {
  15. return this._property;
  16. }
  17. public get value() : any {
  18. return this._obj[this._property];
  19. }
  20. public set value(newValue:any) {
  21. this._obj[this._property] = newValue;
  22. }
  23. public get type() :string {
  24. return Helpers.GET_TYPE(this.value);
  25. }
  26. public get obj() : any {
  27. return this._obj;
  28. }
  29. public set obj(newObj : any) {
  30. this._obj = newObj;
  31. }
  32. }
  33. }