new Enum(itemList)enum.jsline 68
Make a constant-list that has unique values.
In modern browsers (except IE8 and lower),
a value defined once can not be changed.PARAMETERS
Name Type Description itemList
stringArray.<string>
Constant-list (An array of string is available)
EXAMPLES
var Enum = require('tui-code-snippet/enum/enum'); // node, commonjs var MYENUM = new Enum('TYPE1', 'TYPE2'); var MYENUM2 = new Enum(['TYPE1', 'TYPE2']); //usage if (value === MYENUM.TYPE1) { .... } //add (If a duplicate name is inputted, will be disregarded.) MYENUM.set('TYPE3', 'TYPE4'); //get name of a constant by a value MYENUM.getName(MYENUM.TYPE1); // 'TYPE1' // In modern browsers (except IE8 and lower), a value can not be changed in constants. var originalValue = MYENUM.TYPE1; MYENUM.TYPE1 = 1234; // maybe TypeError MYENUM.TYPE1 === originalValue; // true *
Resizable