Files
php-qml/framework/php/tests/snapshot/TodoCompletedEventHandler.qml

32 lines
887 B
QML
Raw Permalink Normal View History

// Auto-generated by `bin/console make:bridge:event TodoCompleted`.
// Listens for `app://event/todo-completed` envelopes published by
// TodoCompletedSubscriber and re-emits them as a typed QML signal.
//
// Drop into a parent component and connect:
//
// TodoCompletedEventHandler {
// onTodoCompleted: function(payload) { console.log("hi", payload) }
// }
import QtQuick
import PhpQml.Bridge
Item {
id: handler
/** Emitted when the bridge publishes app://event/todo-completed. */
signal todoCompleted(var payload)
MercureClient {
baseUrl: BackendConnection.url
token: BackendConnection.token
topics: ["app://event/todo-completed"]
onUpdate: function(topic, envelope) {
if (topic === "app://event/todo-completed") {
handler.todoCompleted(envelope.data)
}
}
}
}