[Integration Kit Contents] [Integration Kit What's New] [Integration Kit Function Index] [More Documentation] [PTC]

Events


sd-create-event
sd-process-event
sd-subscribe-event
sd-unsubscribe-event

Standard Events

SD-CREATE-EVENT

(sd-create-event event)
Description:
Creates a new event which can be processed to invoke subscribed functions.

Parameters:
event {STRING} - the new event name

Return Value:
event {STRING} - new event if successful
nil - event already exists

Example:
(sd-create-event "foo-event")

Function Index Top of Page

SD-PROCESS-EVENT  [function]

(sd-process-event event arguments)
Description:
Invokes all functions subscribed to the event.

Parameters:
event {STRING} - the event name
arguments {LISP forms} - any number of arguments to be passed to all functions subscribed to event

Return Value:
nil - always

Example:
(sd-process-event "foo-event" 12.5 '("string1" "string2"))

Function Index Top of Page

SD-SUBSCRIBE-EVENT  [function]

(sd-subscribe-event event function arguments)
Description:
Subscribes a function to be invoked when the event is processed.

Parameters:
event {STRING} - the event name
function {SYMBOL} - The function to subscribe to the event.
Note: As a rule, subscribed functions should ALWAYS include a &rest parameter to handle additional arguments that maybe passed to the function by sd-process-event.
arguments {LISP forms} - any number of arguments to be passed to function when event is processed

Return Value:
functions {LIST} - a list of functions subscribed to the event

Example:
(defun foo-func (arg &rest more-args)
  (pprint arg)
  (when more-args (pprint more-args)))

(sd-subscribe-event "foo-event" 'foo-func 12.5)
(sd-process-event "foo-event" 24.2)

=> 12.5
   (24.2)

Function Index Top of Page

SD-UNSUBSCRIBE-EVENT  [function]

(sd-unsubscribe-event event function)
Description:
Removes a function from the subscription list of an event.

Parameters:
event {STRING} - the event name
function {SYMBOL} - the function to unsubscribe

Return Value:
functions {LIST} - list of functions still subscribed to the event
function {SYMBOL} - the specified function if the event does not exist

Function Index Top of Page

Standard Events

The following constants identify standard events which are available for use. These constants can be used as parameters for the event functions.

[Integration Kit Contents] [Integration Kit What's New] [Integration Kit Function Index] [More Documentation] [PTC]
© 2024 Parametric Technology GmbH
(a subsidiary of PTC Inc.), All Rights Reserved