Skip to main content

readOnly

Decorator that makes a property read-only in the inspector UI.

TypeNameInterface Description
FunctionsreadOnly(): (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;
}
Copyright © 2026 TikTok. All rights reserved.
About TikTokHelp CenterCareersContactLegalTerms of ServicePrivacy PolicyCookies