|
notify >>-notify(message)--------------------------------------------->< Requests notification about the completion of processing of the message [send] or [start]. The message object [message] is sent as the notification. You can use [notify] to request any number of notifications. After the notification message, you can use the [result] method to obtain any result from the messages [send] or [start]. Message class - notify method
/* Event-driven greetings */
.prompter~new~prompt(.nil)
::class prompter
::method prompt
expose name
use arg msg
if msg \= .nil then do
name = msg~result
if name = "quit" then return
say "Hello," name
end
say 'Enter your name ("quit" to quit):'
/* Send the public default object .INPUT a LINEIN message asynchronously */
msg=.message~new(.input,"LINEIN")~~start
/* Sends self~prompt(msg) when data available */
msg~notify(.message~new(self,"PROMPT","I",msg))
/* Don't leave until user has entered "quit" */
guard on when name="quit"
|