]> git.proxmox.com Git - mirror_xterm.js.git/blobdiff - src/xterm.js
Implement `term.getOption`
[mirror_xterm.js.git] / src / xterm.js
index 08386be39dc2aaa7e74aa266d6c58ea727f19def..f785ab1afab0ebfeca515941d4674a79121a43db 100644 (file)
@@ -357,6 +357,22 @@ Terminal.prototype.focus = function() {
   return this.textarea.focus();
 };
 
+/**
+ * Retrieves an option's value from the terminal.
+ * @param {string} key The option key.
+ */
+Terminal.prototype.getOption = function(key, value) {
+  if (!(key in Terminal.defaults)) {
+    throw new Error('No option with key "' + key + '"');
+  }
+
+  if (typeof this.options[key] != 'undefined') {
+    return this.options[key];
+  }
+
+  return this[key];
+};
+
 /**
  * Sets an option on the terminal.
  * @param {string} key The option key.