From df7162fc151a1df54a7af358464f388173e932d3 Mon Sep 17 00:00:00 2001 From: janwirth Date: Sat, 26 Feb 2022 23:00:12 +0100 Subject: [PATCH] Implement app.shutdown() function --- src/Elm/Kernel/Platform.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Elm/Kernel/Platform.js b/src/Elm/Kernel/Platform.js index d3cf8db0..2e073436 100644 --- a/src/Elm/Kernel/Platform.js +++ b/src/Elm/Kernel/Platform.js @@ -51,7 +51,14 @@ function _Platform_initialize(flagDecoder, args, init, update, subscriptions, st _Platform_enqueueEffects(managers, initPair.b, subscriptions(model)); - return ports ? { ports: ports } : {}; + const shutdown = function() { + managers = null + model = null + stepper = null + ports = null + } + + return ports ? { ports: ports, shutdown: shutdown } : { shutdown: shutdown }; }