Mini apps
This export option converts a notebook into a window application that uses WLJS as a runtime and works in an isolated context.
Call Share from the top menu or click the icon and choose Mini app:
Use cases
- Calculators and utilities
- Useful tools for processing data with a GUI
- Share your notebook in the form of a small app
- Share your notebook as a web app in your network (if WLJS is run on a server)
All initialization cells of the notebook are evaluated on startup, and the last input cell becomes the main window of the app.
CellPrintHow to Prepare a Mini App
In general, you can think of a mini app as if it were an output of a single cell projected (see Project feature) to a window. The following rules apply:
- The default context (
$Context) of all symbols is randomly generated and will be unique for each running instance of your app - All initialization cells will be executed automatically on the startup of an app
- The output of the last input cell will be the first window of your app
- Use WLX for the last input cell
- An app will pick the first available computation kernel in your system
Apart from that, the program for the widget is just a plain WLJS notebook. You can leave cells there for testing and debugging with no impact.
Example 1
Let's write the simplest possible interactive widget:
(* make it initialization cell *)
equation[x_,n_] := Sum[(Sin[2[Pi](2j - 1) x])/(2j - 1), {j, 1, n}];
Widget = ManipulatePlot[equation[x,n]//Re, {x, -1,1}, {n, 1,10,1}];
.wlx
<Widget/>
Then export it as Mini app and double-click the created file. You can open it anytime on any machine with WLJS Notebook installed.