WLJS LogoWLJS Notebook

NotebookStore

Wolfram Kernel

Represents a key in the permanent local notebook storage. You can carry the raw data within the notebook, regardless if it has been exported to Static HTML and imported back.

Representation of a single key:

NotebookStore[key_String]

Representation of multiple keys:

NotebookStore[{key1, key2, key3, ..}]

Explicitly specify a notebook:

NotebookStore[nb_RemoteNotebook, key_String] _

It works like a key-value storage.

Methods

Write

To assign any Wolfram Expression using NotebookWrite:

NotebookWrite[NotebookStore["key"], expr_]

Read

To get the data use NotebookRead:

NotebookRead[NotebookStore["key"]]

Be aware of a evaluation context loss, use EvaluationNotebook for such cases if it is called from an external handler, i.e.

(* evaluation context is ok *)
NotebookWrite[NotebookStore["key"], 123];

With[{n = EvaluationNotebook[]},
	(* evaluation context is ok *)
	EventHandler[InputButton[], AsyncFunction[Null, Module[{data},
		(* evaluation context is lost!!! *)
		
		data = NotebookReadAsync[NotebookStore[n, "key"]] // Await;
        NotebookWrite[NotebookStore[n, "key"], data+1];
	]]]
]

Then check:

NotebookRead[NotebookStore["key"]]

On this page