Skip to content

Commit 5a1baa8

Browse files
committed
chore: update annotations
1 parent 9bcfceb commit 5a1baa8

File tree

3 files changed

+42
-6
lines changed

3 files changed

+42
-6
lines changed

docs/documentation/godot-js-scripts/decorators.md renamed to docs/documentation/godot-js-scripts/annotations.md

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
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
88
import { createClassBinder } from "godot.annotations";
@@ -131,3 +131,39 @@ accessor color: MyColor = MyColor.White;
131131
The 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+
```

docs/documentation/godot-js-scripts/intro.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ export default class MyJSNode extends Node {
6464
## Annotations
6565

6666
Annotations 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

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ nav:
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

0 commit comments

Comments
 (0)