0 Replies Latest reply on Oct 10, 2008 4:10 AM by (Tino_Runtzler)

    Defining constants/enums with const in JavaScript

    Level 1
      Hi folks,

      I like to define constant enums like the InDesign DOM already provides, e.g.:
      SpecialCharacters.FORCED_LINE_BREAK
      StateTypes.DOWN
      etc.

      I like to define such enums too. The only approach I found was:

      const MY_ENUM = {TOP:"top",DOWN:"down"}

      But this is not write-safe. I can add properties/functions to MY_ENUM as well as change the value of TOP. Thats not desirable.

      Whereas the InDesign DOM enums are readonly. The enum object as well as the value/property. How can I define such type with JavaScript?

      Thanks for your comments
      Cheers Tino