Changes between Version 27 and Version 28 of SystemDevelopmentEN


Ignore:
Timestamp:
Jul 20, 2013, 11:17:02 AM (11 years ago)
Author:
Martin Kolman
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • SystemDevelopmentEN

    v27 v28  
    148148
    149149== Signals ==
     150There is a built-in signaling system, represented by the Signal class in the core.signal shared module. It is is a classic signaling implementation: signals can be declared, connected to and arguments can be passed when the signal is triggered.
     151
     152Example:
     153{{{
     154#!python
     155
     156from core.signal import Signal
     157
     158# declare the signal
     159spamArrived = Signal()
     160
     161# create signal handler
     162def handleSpam(spamType):
     163  print("delicious %d arrived!" % spamType)
     164
     165# connect handler to the signal
     166spamArrived.connect(handleSpam)
     167
     168# trigger the signal & pass an argument
     169spamArrived("original SPAM")
     170}}}
     171
    150172
    151173