From f50befc50381fd6d41db9bdf5d5e65dd4581d65b Mon Sep 17 00:00:00 2001 From: Leo Horie Date: Wed, 21 May 2014 23:16:16 -0400 Subject: [PATCH] update docs about when it's appropriate to use start/endComputation --- docs/mithril.computation.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/mithril.computation.md b/docs/mithril.computation.md index e9ccd80a..07162679 100644 --- a/docs/mithril.computation.md +++ b/docs/mithril.computation.md @@ -1,5 +1,7 @@ ## m.startComputation / m.endComputation +Typically, `m.startComputation` / `m.endComputation` don't need to be called from application space. These methods are only intended to be used by people who are writing libraries that do things asynchronously. + If you need to do custom asynchronous calls without using Mithril's API, and find that your views are not redrawing, or that you're being forced to call [`m.redraw`](mithril.redraw.md) manually, you should consider using `m.startComputation` / `m.endComputation` so that Mithril can intelligently auto-redraw once your custom code finishes running. In order to integrate an asynchronous code to Mithril's autoredrawing system, you should call `m.startComputation` BEFORE making an asynchronous call, and `m.endComputation` after the asynchronous callback completes.