Invoking the diagnostics getter would throw an exception because the JsDiagnostic type has no constructor.
There's however no constructor that would allow for the previous
laziness, so instead this PR bites the bullet:
- When diagnostics are requested, we convert them all in one go into proper JavaScript objects.
- The vector returned by line_column is replaced with more idiomatic column and lineNumber properties
* Startup with napi.
* Added interpreter api for napi.
* Initial implementation of set_property/get_property on ComponentInstance
Co-authored-by: Florian Blasius <FloVanGH@users.noreply.github.com>
* fixup! minimal napi setup
* Type conversion for napi.
* Work on napi callbacks.
* Fix life-time of JsFunction kept in closures for callbacks
The life-time of napi values is limited to the method invocation from napi itself.
In order to keep a value beyond that, it's necessary to use persistent references:
https://nodejs.org/api/n-api.html#references-to-values-with-a-lifespan-longer-than-that-of-the-native-method
* Added callback tests for napi.
* Fix licenses for napi stuff.
* Update api/napi/src/interpreter/component_instance.rs
Co-authored-by: Olivier Goffart <olivier.goffart@slint-ui.com>
* Update api/napi/src/interpreter/component_instance.rs
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* Code review stuff
* Update api/napi/src/interpreter/component_definition.rs
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* Update api/napi/src/interpreter/component_instance.rs
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* Update api/napi/src/interpreter/component_instance.rs
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* code review fixes
* ci fix
* code review fixes.
* up
* Revert "up"
This reverts commit 06412f1acf.
* ci fix
---------
Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
Co-authored-by: Florian Blasius <FloVanGH@users.noreply.github.com>
Co-authored-by: Olivier Goffart <olivier.goffart@slint-ui.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>