File tree Expand file tree Collapse file tree 3 files changed +42
-6
lines changed
docs/documentation/godot-js-scripts Expand file tree Collapse file tree 3 files changed +42
-6
lines changed Original file line number Diff line number Diff line change 1- # Decorators
1+ # Annotations
22
3- There are several decorators to help you define properties, signals, and other metadata for Godot objects.
3+ There are several annotations to help you define properties, signals, and other metadata for Godot objects.
44
5- All decorators are accessed through the ` createClassBinder ` function:
5+ All annotations are accessed through the ` createClassBinder ` function:
66
77``` ts
88import { createClassBinder } from " godot.annotations" ;
@@ -131,3 +131,39 @@ accessor color: MyColor = MyColor.White;
131131The value can be easily chosen from a dropdown list in the editor.
132132
133133![ enum_prop] ( images/export_enum_inspector.png )
134+
135+ ## Documentation comments
136+
137+ You can use [ documentation comments] ( https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_documentation_comments.html )
138+ with custom GodotJS annotations:
139+
140+ - `` @bind.help("...") ``
141+ - `` @bind.experimental("...") ``
142+ - `` @bind.deprecated("...") ``
143+
144+ ``` ts
145+ import { Variant } from " godot" ;
146+ import { createClassBinder } from " godot.annotations" ;
147+
148+ const bind = createClassBinder ();
149+
150+ @bind ()
151+ @bind .help (" This will be shown in the editor when creating a new node of this type." )
152+ export default class TestNode extends Node {
153+
154+ @bind .experimental (" Alternative to [method TestNode.doNewStuff]." )
155+ doNewStuff(){
156+ // ...
157+ }
158+
159+ doStuff(){
160+ // ...
161+ }
162+
163+ @bind .deprecated (" Use [method TestNode.doNewStuff] instead." )
164+ doOldStuff(){
165+ // ...
166+ }
167+
168+ }
169+ ```
Original file line number Diff line number Diff line change @@ -64,8 +64,8 @@ export default class MyJSNode extends Node {
6464## Annotations
6565
6666Annotations are used to define properties, signals, and other metadata for Godot objects.
67- They are similar to decorators in TypeScript and can be used to enhance the functionality of your scripts.
68- Check out [ decorators ] ( decorators .md) for more information.
67+ They are similar to annotations in TypeScript and can be used to enhance the functionality of your scripts.
68+ Check out [ annotations ] ( annotations .md) for more information.
6969
7070## Auto-Completion and Codegen
7171
Original file line number Diff line number Diff line change 1212 - Use External Editor : documentation/use-external-editor.md
1313 - Scripting :
1414 - Intro : documentation/godot-js-scripts/intro.md
15- - Decorators : documentation/godot-js-scripts/decorators .md
15+ - Annotations : documentation/godot-js-scripts/annotations .md
1616 - Signals : documentation/godot-js-scripts/signals.md
1717 - Cyclic Imports : documentation/godot-js-scripts/cyclic-imports.md
1818 - Bindings : documentation/godot-js-scripts/bindings.md
You can’t perform that action at this time.
0 commit comments