shutdown

Sent to the current card of the defaultStack when the application is quitting.

# Metadata

Platforms: desktop, server, mobile OS: mac, windows, linux, ios, android Introduced: 1.0 Security:

# Syntax

shutdown

# Examples

on shutdown save stack "Preferences" pass shutdown end shutdown

# Description

Handle the shutdown message if you want to perform cleanup tasks before the application quits.

The actual quit process is not triggered by the shutdown message, so trap the message and not allowing it to pass does not prevent the application from quitting.

In standalones, some care is needed to ensure you receive the shutdown message if your application uses multiple stacks. The most reliable approach is to install a library stack or backscript to handle the message when your application starts up.

>*Note:* Applications will not receive this message when running in the > IDE.

# Tags

# See

- **property:** defaultStack, defaultStack - **message:** closeStack, closeCard, closeBackground, suspend - **command:** quit - **glossary:** application, trap, message, current card - **control structure:** pass