godotjs / javascript

Javascript binding for godotengine
https://godotjs.github.io/
MIT License
980 stars 82 forks source link

Implement new function #128

Closed Vercix closed 1 year ago

Vercix commented 2 years ago

This pull request would implement the new function. This will create a more convenient API for instantiating JavaScript classes in GDScript.

For example:

var ControllerApp = preload("res://dist/GodotFreApp.jsx")

# Called when the node enters the scene tree for the first time.
func _ready():
    var x = ControllerApp.new(1, null, 'some_other_prop', self)
    add_child(x)

This is related to #107

There is a few things that I am not happy about with this implementation, though.

Looking forward to review and suggestions.

Geequlim commented 1 year ago

I don't think this is a good idea to add statics new methods to godot classes. It will confuse people who are not familiar with godot that much. Some classes can create instances with new method but some are not in same project. So it is better to follow the EcmaScript standard.

fire commented 1 year ago

I don't think @Geequlim agrees with this design, and there has been no activity.

Ok to close?

fire commented 1 year ago

Closing due to lack of support from a maintainer.

Feel free to comment or revise.