VM Interface for message oriented programming operations.
class VMSlot( name )
init | VM Interface for message oriented programming operations. |
assert() | Creates a message assertion on this certain message slot. |
broadcast() | Performs broadcast on this slot. |
first() | Gets an iterator to the first subscriber. |
getAssert() | Gets the item asserted for this slot. |
last() | Gets an iterator to the last subscriber. |
name() | Returns the name of this slot |
prepend() | Registers a callback handler that will be called before the others. |
retract() | Removes a previous assertion on a message. |
subscribe() | Registers a callback handler on this slot. |
unsubscribe() | Unregisters a callback handler from this slot. |
VM Interface for message oriented programming operations.
The VMSlot instance is a direct interface to the messaging facility of the VM creating it. It is implicitly created by the getSlot function, but it can be directly created by the user.
If a slot with the given name didn't previously exist, a new message slot is created in the virtual machine, otherwise the already existing slot is wrapped in the returned instance.
// create a message slot x = VMSlot( "message" ) x.subscribe( handler ) ... y = VMSlot( "message" ) y.broadcast( "value" ) // handler is called.
Same happens if the VMSlot is created via getSlot, or implicitly referenced via subscribe function. Slots are considered unique by name, so that comparisons on slots are performed on their names.
VM Interface for message oriented programming operations.
init VMSlot( name )
name | The name of the mesasge managed by this VMSlot. |
The VMSlot instance is a direct interface to the messaging facility of the VM creating it. It is implicitly created by the getSlot function, but it can be directly created by the user.
If a slot with the given name didn't previously exist, a new message slot is created in the virtual machine, otherwise the already existing slot is wrapped in the returned instance.
// create a message slot x = VMSlot( "message" ) x.subscribe( handler ) ... y = VMSlot( "message" ) y.broadcast( "value" ) // handler is called.
Same happens if the VMSlot is created via getSlot, or implicitly referenced via subscribe function. Slots are considered unique by name, so that comparisons on slots are performed on their names.
Creates a message assertion on this certain message slot.
VMSlot.assert( data )
data | The value of the assertion. |
If there are already subscribed callbacks for this message a broadcast on them is performed now.
Performs broadcast on this slot.
VMSlot.broadcast( ... )
... | Extra parameters to be sent to listeners. |
Gets an iterator to the first subscriber.
VMSlot.first( )
Returns: | An iterator to the first subscriber of this message slot. |
Gets the item asserted for this slot.
VMSlot.getAssert( [default] )
default | If given, instead of raising in case the essartion is not found, return this item. | ||
Raises: |
|
Gets an iterator to the last subscriber.
VMSlot.last( )
Returns: | An iterator to the last subscriber of this message slot. |
Returns the name of this slot
VMSlot.name( )
Returns: | The name of the event bind to this slot (as a string). |
Registers a callback handler that will be called before the others.
VMSlot.prepend( handler )
handler | The callable that must be unregistered. |
Removes a previous assertion on a message.
VMSlot.retract( )
Registers a callback handler on this slot.
VMSlot.subscribe( handler, [prio] )
handler | A callable item or instance providing callback support. |
prio | Set to true to have this handler called before the previous ones. |
Unregisters a callback handler from this slot.
VMSlot.unsubscribe( handler )
handler | The callable that must be unregistered. | ||
Raises: |
|