How can I make an enumeration in WinJS?
I tried to make a class like this for example:
(function () {
"use strict";
var TaskEnum = WinJS.Class.define(
null,
{},
// The set of static members.
{
SUPERVISION: 1,
DIG: 2,
MAP: 3,
});
var Task = new TaskEnum();
WinJS.Namespace.define("ENUMS", {
TASK: {
get: function () {
return Task;
}
}
});
})();
But when I call ENUMS.TASK.DIG
then DIG is undefined.
I even tried just this:
WinJS.Namespace.define("ENUMS", {
TASK: { SUPERVISION: 1, DIG: 2, MAP: 3, }
});
But when I call ENUMS.TASK.DIG
then DIG is still undefined.
It seems like the Namespace.define does not work in that way?
Ohk, If i get you exact then , you want to define Enumeration
in JavaScript?
right ?
For this case I don't think if it is done with WinJs or not on Windows Store App
,
but I have two Suggestions as my answer :
1 ) Use C#
as Runtime Component to perform This operations, by defining a function in c# and simply call it on your JavaScript.
See ,Creating a simple component in C#.
2 ) Enumerated types in JavaScript
Or See : WinJS.UI Namespace
http://207.46.99.208/pl-pl/library/windows/apps/br229782#enums_section