This module is auto-loaded by the scripting plugin. It provides the implementation
of the global josm
object.
Name | Description |
---|---|
Properties | |
commands | Replies the global command history. |
layers | accessor for JOSM layers |
menu | Replies an accessor for JOSMs menu bar. |
version | JOSM version string |
Methods | |
alert | display a message |
open | Opens one or more files in JOSM |
commands:CommandHistory
Replies the global command history.
Use this object to undo/redo commands, or to clear the command history.
// undoes the last command
josm.commands.undo();
// redoes two commands
josm.commands.redo(2);
layers:object
Replies the layers object.
josm.alert("num layers: " + josm.layers.length);
// name of first layer
josm.alert("num layers: " + josm.layers.get(0).name);
Replies an accessor for JOSMs menu bar.
Use this object to inspect or modify the menu bar, i.e. to add additional menu items.
version:string
Replies the current JOSM version string.
josm.alert(josm.version);
alert
Displays an alert window with a message
Signaturesalert(message)
alert(message, ?options)
title
:stringmessageType
// display an information alert
josm.alert("Hello World!");
// display an error alert
josm.alert("Got an error", {
title: "Error Alert",
messageType: "error"
});
open
Opens one or more files in JOSM.
Accepts a variable number of files. Each argument is either a string (a file name) or a java.io.File.
Creates and opens layers in JOSM, depending on the kind of file opened: