From 40fa1ea86be5af9ad1d5561d3f3303edb788d17d Mon Sep 17 00:00:00 2001 From: Leo Horie Date: Mon, 19 Jan 2015 22:55:54 -0500 Subject: [PATCH] document edge case return value --- docs/mithril.module.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/mithril.module.md b/docs/mithril.module.md index 6c5a3d8e..f96e7720 100644 --- a/docs/mithril.module.md +++ b/docs/mithril.module.md @@ -118,6 +118,8 @@ module1.controller = function() { } ``` +Normally, calling `m.module` will return the controller instance for that module, but there's one corner case: if `preventDefault` is called from a controller's `onunload` method as a result of calling `m.module`, then the `m.module` call will not instantiate the new controller, and will return `undefined`. + To unload a module without loading another module, you can simply call `m.module` without a module parameter: ```javascript