Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
New Contributor
Posts: 3
Registered: ‎01-06-2012
My Device: Torch 9860
My Carrier: Bell Mobility

Javascript Enums - To Bug or not a Bug

Hi all,

 

Would like to know if there is a bug with enums using JavaScript or if it is simply an implementation error.

 

var SIZE = {

SMALL : {value: 0, name:

"Small", code: "S"},

MEDIUM: {value: 1, name:

"Medium", code: "M"},

LARGE : {value: 2, name:

"Large", code: "L"}

};

var defaultStatus = new enums.Enum("close", "open");

 

addEventListener(

"DOMContentLoaded", onLoad, false);

 

function onLoad() {

var enum1Test = SIZE.MEDIUM;  // error @ this point...

//var enum2Test = defaultStatus.close;  // error @ this point...

}

 

Both are generating errors in WebWorks (SDK 2.3 - latest download from BB WebWorks dev site).

 

Any feedback would be greatly appreciated.

 

Thank you.

Retired
Posts: 518
Registered: ‎07-18-2011
My Device: Bold
My Carrier: Rogers

Re: Javascript Enums - To Bug or not a Bug

What device/OS are you testing this on? The initial test (SIZE) worked for me, but I've never tried using enum.js personally.



1.Please resolve your thread by clicking the "Accept as Solution" button below the post which solved your problem!
2. If any post helps you please click the button below the post(s)
New Contributor
Posts: 3
Registered: ‎01-06-2012
My Device: Torch 9860
My Carrier: Bell Mobility

Re: Javascript Enums - To Bug or not a Bug

Device: Blackberry Torch 9810
OS Blackberry OS 7