#2708 JS: Enum.vals()

SlimerDude Thu 16 Aug 2018

Does Enum.vals() exist in Javascript land? I seem to get an error:

sys::Err: fan.sys.Month.vals is not a function

If not, how would I get a Month instance from an ordinal so I can create a DateTime instance?

Note I'm trying to call from within Javascript - console.info( fan.sys.Month.vals() )

SlimerDude Thu 16 Aug 2018

Some digging in sys.js gives me:

fan.sys.Month.m_vals

Which I can use like this:

var d = fan.sys.DateTime.make(2018, fan.sys.Month.m_vals.get(8), 16);

Still, it may be nice to expose a static vals() method, no?

andy Thu 16 Aug 2018

Yep -- compilerJs optimizes to a field access when it can

Login or Signup to reply.