Skip to main content

$pushgate.cancelEvent

The method cancels an event previously created via the $pushgate.createEvent method.

Syntax

The $pushgate.cancelEvent method accepts one argument — the identifier of the event created via $pushgate.createEvent.

$pushgate.cancelEvent("1234567");

Example

Consider the following example of setting and canceling an alarm.

state: SetAlarm
intent!: /Alarm/Set
a: At what time?

state: Time
q: * @duckling.time *
script:
$temp.time = $parseTree["_duckling.time"];
# Schedule a new event.
$temp.event = $pushgate.createEvent($temp.time.value);
# Remember the event identifier.
$session.alarmId = $temp.event.id;
a: The alarm has been set for {{$temp.time.hour}}:{{$temp.time.minute}}.

state: CancelAlarm
intent!: /Alarm/Cancel
script:
# Cancel the remembered event.
$pushgate.cancelEvent($session.alarmId);
delete $session.alarmId;
a: The alarm has been canceled.