WLJS LogoWLJS Notebook

Refresh

Wolfram Kernel

Implementation differs from Wolfram Standard Library

Refresh[expr_, interval_]

produces a dynamic window with expr reevaluated each interval of time specified in seconds or in Quantity

Refresh[expr_, trigger_EventObject | trigger_String]

produces a dynamic window with expr reevaluated by trigger event (see Events).

Referesh has HoldFirst attribute.

Unlike Animate, Refresh will throttle the refresh rate if the CPU time takes more than provided interval.

Example

Refresh[Now // TextString, 1]

or even for decorated symbols

Refresh[Now, 1]

JIT Features

Refresh expression uses the same runtime optimization features as Manipulate and Animate, which can benefit some cases and prevent full reevaluation.

For example:

Refresh[RandomImage[], 0.2]

or

Refresh[ListLinePlot[RandomReal[{-1,1}, 100]], 0.2]

Be careful with Plot or any other functions placed as expr with a fast refresh rate (< 1 second). It might cause a significant load to the system in some cases if JIT optimizations were not successful. Test it on longer update times beforehand.

Consider to use Offload for rapidly changing data AnimatePlot or PlotlyExtendTraces.

On this page