MCPcopy
hub / github.com/witheve/Eve / defineOption

Function defineOption

src/codemirror.js:9723–9741  ·  view source on GitHub ↗
(name, defaultValue, type, aliases, callback)

Source from the content-addressed store, hash-verified

9721
9722 var options = {};
9723 function defineOption(name, defaultValue, type, aliases, callback) {
9724 if (defaultValue === undefined && !callback) {
9725 throw Error('defaultValue is required unless callback is provided');
9726 }
9727 if (!type) { type = 'string'; }
9728 options[name] = {
9729 type: type,
9730 defaultValue: defaultValue,
9731 callback: callback
9732 };
9733 if (aliases) {
9734 for (var i = 0; i < aliases.length; i++) {
9735 options[aliases[i]] = options[name];
9736 }
9737 }
9738 if (defaultValue) {
9739 setOption(name, defaultValue);
9740 }
9741 }
9742
9743 function setOption(name, value, cm, cfg) {
9744 var option = options[name];

Callers 1

VimFunction · 0.85

Calls 1

setOptionFunction · 0.85

Tested by

no test coverage detected