-
Notifications
You must be signed in to change notification settings - Fork 41
Closed
Labels
Description
The original issue is White-Oak/qml-rust#8.
So the problem is :
onPageDownloaded
is a signalfn pageDownloaded(response: String)
onPageDownloaded: console.log("Page Downloaded "+ response);
fails with an errorReferenceError: response is not defined
, because attributes' names are not used on registration.
I see three solutions to the original problem:
- Use
arguments
:
onPageDownloaded: console.log("Page downloaded " + arguments[0]);
Remember, that in JS you can always check what are the arguments of the function (see this answer on SO)
2. Connect signal to function in qml like this
Component.onCompleted: {
visible = true;
logic.pageDownloaded.connect(jsPageDownloaded);
}
function jsPageDownloaded(response) {
console.log("Page downloaded " + response);
}
// ...
This is more verbose.
3. Provide an ability to register attribute name on registration.
Currently SignalDefinition
consists of signal's name, number of attributes and their types. Is it possible to provide names of attributes as well?