Differences
This shows you the differences between two versions of the page.
Both sides previous revision
Previous revision
|
|
blocks:drivers:example [2022-06-22 18:54] admin removed atom references |
blocks:drivers:example [2023-06-12 11:11] (current) admin Clarified connect callback parameters |
</code> | </code> |
| |
Event subscriptions are similar to how //addEventListener// is used in web browsers to listen to DOM events. The 'connect' event indicates that the connection status of the socket has changed. All events are described in the Network.ts file. Jump directly to the relevant declaration by command/control-clicking a //subscribe// call. | Event subscriptions are similar to how //addEventListener// is used in web browsers to listen to DOM events. The 'connect' event indicates that the connection status of the socket has changed or failed (as indicated by the type field of the message parameter). All events are described in the Network.ts file, so always look there for full details. Jump directly to the relevant declaration by command/control-clicking a //subscribe// call. |
| |
When the subscribed-to event occurs, the function body following the //[[https://basarat.gitbooks.io/typescript/docs/arrow-functions.html|lambda]]// => operator will be invoked. Either do what needs to be done right here, if its only a line or two, or call a function defined elsewhere in the driver. | When the subscribed-to event occurs, the function body following the //[[https://basarat.gitbooks.io/typescript/docs/arrow-functions.html|lambda]]// => operator will be invoked. Either do what needs to be done right here, if its only a line or two, or call a function defined elsewhere in the driver. |