ramblings/oxygen/js-options/hello.js

51 lines
1.8 KiB
JavaScript
Raw Normal View History

2021-04-28 14:48:01 +00:00
hello = function () {
include('options.js');
2021-04-29 12:06:43 +00:00
// Instanciation
Packages.java.lang.System.out.println("<new Options(authorAccess, 'hello', 3)>");
var options = new Options(authorAccess, 'hello', 3);
Packages.java.lang.System.out.println("</new Options(authorAccess, 'hello', 3)");
2021-04-29 12:06:43 +00:00
// Set up a couple of options
2021-04-28 14:48:01 +00:00
options.setOption('Hello', 'World');
options.setOption('See you later', 'aligator');
2021-04-29 12:06:43 +00:00
// Retrieve and display these options
2021-04-28 14:48:01 +00:00
var myOptions = options.getOptions();
for (var key in myOptions) {
var value = myOptions[key];
Packages.java.lang.System.out.println(key + ' ' + value);
}
2021-04-29 12:06:43 +00:00
// Do the same with file specific options
Packages.java.lang.System.out.println("<options.setSystemId(undefined, 2)>");
options.setSystemId(null, 2);
Packages.java.lang.System.out.println("</options.setSystemId(undefined, 2)>");
2021-04-29 10:04:41 +00:00
options.setSystemIdOption('Hello', 'aligator');
options.setSystemIdOption('See you later', 'World');
var myOptions = options.getSystemIdOptions();
for (var key in myOptions) {
var value = myOptions[key];
Packages.java.lang.System.out.println(key + ' ' + value);
}
2021-04-29 12:06:43 +00:00
// Display some file specific properties
2021-04-29 09:32:07 +00:00
Packages.java.lang.System.out.println('options.systemId: ' + options.systemId);
Packages.java.lang.System.out.println('options.systemIdDigest: ' + options.systemIdDigest);
Packages.java.lang.System.out.println("<new Options(authorAccess, 'hello2', 20)>");
var options = new Options(authorAccess, 'hello2', 20);
Packages.java.lang.System.out.println("</new Options>");
// Delete options
// Packages.java.lang.System.out.println('Deleting options');
// options.deleteOption ('Hello');
// options.deleteOption ('See you later');
// myOptions = options.getOptions();
// for (var key in myOptions) {
// var value = myOptions[key];
// Packages.java.lang.System.out.println(key + ' ' + value);
// }
}