Satimage Previous
notify
Home Documentation Smile Smile's objects Scheduling tasks notify  
notify the_object from the_sender with data the_payload with delay the_delay will post a notify message to be delivered to the_object after a delay specified in seconds by the_delay.
  • the_object must be an object. The script of the_object is the recipient of the message: it must include a on notify [...] handler in order to be able to handle the message.
  • the_sender may be whatever quantity specifying the origin of the message - for instance, a string, a reference to the sender object.
  • the_payload may be whatever quantity suitable to carry the content of the message.
In the example below, notify is used to perform a periodical task.
on notify the_object from the_sender with data the_payload
    quietmsg("Received " & (display the_payload) & " from " & (display the_sender))
    -- perform some task
    notify the_object from the_object with data the_payload with delay 300 -- program next call in 5 minutes
end notify
Please note: the from parameter, as well as the with data parameter, are optional, both in the calls and in the declaration of the handler. However, if the declaration specifies some parameter and the call does not include it, the call will be ineffective: in this sense, the parameters are not so optional in the calls. If you declare a parameter in the recipient handler, be sure to pass it in all calls. For instance, if the recipient handler is declared like:
on notify the_object with data the_payload
    quietmsg("Received " & (display the_payload))
    -- perform some task
    notify the_object from the_object with data the_payload with delay 300 -- program next call in 5 minutes
end notify
then the following call will be effective:
notify the_object from "me" with data the_payload
but the following will not be trapped by the handler because the with data parameter is missing:
notify the_object
Copyright ©2008 Paris, Satimage