Interface

JavaScript interface

These functions can be called in the browser and are written in JavaScript.

PlutoBoard.callJuliaFunctionMethod
async callJuliaFunction(
	func_name,
	{ args = [], kwargs = {}, response_callback = () => { }, internal = false } = {}
) -> Promise

Calls specified Julia function with args and callback within browser context from JavaScript.

Args:

  • func_name: String: Function name of the called Julia function

Kwargs:

  • args: Array: Args for the Julia function
  • kwargs: Dict: Kwargs for the Julia function
  • response_callback: Function: Function that gets called when a new message is being sent from the Julia function
  • internal: Boolean = false: Whether the targeted function is in PlutoBoard package. Only used for internal calls, defaults to false

Example usage:

callJuliaFunction("get_cube", {
	args: [number],
	response_callback: (
		r => {
			const outP = document.getElementById("buttonOutput");
			outP.innerHTML = `Cube of ${number}... ${Math.round(r * 100)}%`;
		}
	)
	}).then(
		r => {
			const outP = document.getElementById("buttonOutput");
			outP.innerHTML = `The cube of ${number} is ${r}`;
		}
	)
source

Julia interface

PlutoBoard.initializeMethod
initiliaize(
	html_path::String,
	;
	hide_notebook::Bool = true,
	scripts::Array{String} = [],
	links::Array{String} = [],
) -> nothing

Initializes the PlutoBoard module with parameters. scripts and links are urls to scripts and stylesheets.

source
PlutoBoard.runFunction
run(debug::Bool=false)

Runs the Pluto notebook with the PlutoBoard notebook. If debug is true, the notebook will reload when the file changes. Additionally copies the interface.js file to the lib directory of the current directory.

source