Comments (6)
Thanks for your report.
This bug will be fixed in next release.
from ecmascript.
The latest commit fixed this problem.
Here is the demo to using anonymous ECMAScript with the gdclass
decorator in TypeScript.
import { signal, gdclass, property } from "./decorators";
@gdclass
class MyNode extends godot.Control {
@signal
test_func: string;
js_method_test() {}
@property({ default: "Hello Godot Property" })
string_prop: string;
}
@gdclass
class MyMyNode extends MyNode {
@signal
test_func2: string;
};
export default class Control extends godot.Control {
_ready() {
console.log('--------------');
var n = new MyMyNode();
console.log(n.has_signal('test_func'));
console.log(n.has_signal('test_func2'));
console.log(n.string_prop === 'Hello Godot Property');
console.log(n.has_method('js_method_test'));
n.free();
console.log('--------------');
}
}
from ecmascript.
honestly I'm not sure what the behavior in gdscript is, although I believe the behavior I'm expecting did work in C#. I should check in gdscript.
from ecmascript.
I was able to get around this for now like so:
import B from "./B.jsx"
export default class A extends godot.Node {
@signal static readonly mysignal: string;
_ready() {
const b = new B();
b.set_script(godot.load('res://B.jsx')
this.add_child(b);
}
}
You can't preload or there will be a stack overflow because of a cyclic dependency it seems.
from ecmascript.
@Geequlim I am starting to use the gdclass
decorator and it's not in the generated decorators.js, it's in the godot.d.ts, is this intended? I had to manually move it over for it work since .d.ts files don't emit js.
from ecmascript.
@MichaelBelousov Thanks for your remind. gdclass
is moved to decorator.ts
now.
from ecmascript.
Related Issues (20)
- CommonJS Module Support HOT 4
- Steps needs to run wasm HOT 1
- [Suggestion] Documentation and getting started tutorial HOT 8
- dev is ok , when i build get error below HOT 1
- Refactor repo branches to enable good publish process HOT 9
- Close issues that refer to Godot Engine 3 but don't exist in Godot Engine 4 HOT 1
- [4.1-v0.0.17] Signal arguments makes it crash HOT 4
- Get started page 404 HOT 2
- Configuring esbuild for bundling classes issue
- Missing template / examples for pre-release HOT 2
- Can I add this to an existing godot install? HOT 1
- .d.ts file has errors HOT 6
- Condition "!is_inside_tree()" is true. HOT 2
- Master build does not build with Godot HOT 2
- Unicode parsing error: Invalid unicode codepoint (fffd), cannot represent as ASCII/Latin-1 HOT 1
- Global pollution HOT 2
- Creating an object in js lost all built-in function links
- [BUMP] GodotJS addon: CSS integration
- 4.2+ support
- Is it dead? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ecmascript.