module salix::util::SaveLoad
rascal-0.43.0
org.rascalmpl.salix-core-0.3.0
Usage
import salix::util::SaveLoad;
Dependencies
import salix::App;
import salix::Core;
import salix::HTML;
import IO;
import ValueIO;
import String;
data Msg
data Msg
= saveModel()
| loadModel()
| modelFileRead(value contents, value error)
| modelFileDone()
;
function saveButton
Create a save button
void saveButton(value vals...)
Examples
saveButton("Save...")
function loadButton
Create a load button
void loadButton(value vals...)
Examples
saveButton("Load...")
function withSaveLoad
Adds model save and load actions to an application update function.
&T(Msg, &T) withSaveLoad(type[&T] modelType, &T(Msg, &T) update,
str filename = "model", str extension = ".rval")
This wrapper gives access to the browser's own save and load file dialogs.
Use withSaveLoad(#Model, update) as the update argument of Make App.
Then call Save Button and Load Button inside your view at the required positions.
loaded models (in ValueIO format). The files are saved to disk in a UTF-8 ValueIO text format.
Examples
- See SaveLoadCounter for a complete example.
function showError
void showError(str message)