The normal lifecycle is that a toast notification is destroyed when either of the following happens:
The user clicks on it
The toast reaches its expiry time (either the app's default of a few seconds, or an explicit
There can be two exceptions to this lifespan:
The toast is given
And/or, the toast is given a long
In either of these circumstances, the caller may want to remove the toast manually, using
// Note: no callback. DestroyToast() is fire-and-forget.
Framework.DestroyToast("1234-5678-abcd");
The ID of the toast, for passing to
By providing an explicit
Using the
For example, to display a permanent toast until the user clicks on it (replacing the automatic destruction in the event of a click):
Framework.CreateToast({
title: "Permanent…",
text: "Stays on screen until manually destroyed",
noDestroyOnClick: true,
lifespan: 999999999
}, function (ToastClickMsg) {
… some asynchronous process during which the toast remains on screen,
and then …
Framework.DestroyToast(ToastClickMsg.toastId);
});