readOnly
Decorator that makes a property read-only in the inspector UI.
| Type | Name | Interface Description |
|---|---|---|
| Functions | readOnly(): (target: any, key: string) => any | • Function: Decorator that makes a property read-only in the inspector UI. The property value can still be modified programmatically but not through the UI. This decorator can be used with or without parentheses. Returns Property decorator function when used with parentheses |
Example
@component()
export class Statistics extends APJS.BasicScriptComponent {
@serializeProperty()
public totalScore: number = 0;
@serializeProperty()
@readOnly()
public gamesPlayed: number = 0;
}