locked
How to expose enum from my C++ based WinRT Component DLL to JavaScript? RRS feed

  • Question

  • Hi Guys. I'm having problem using enum definitions(in my C++ based WinRT Comp) in JavaScript Metro style App.
    I first created a WinRT comp project, generated Dll. Then created a JS Metro app which references the prev dll.
    Then I find there's not an easy way to use the enum defs in JS, although I managed to implement with static properties...
    Could u plz give me some hint on this?

    Sample Code:

    namespace WinRTCompDll
    {
        // not visible in JS since not in [public ref ... sealed] format
    	enum class AlertType
    	{
    		Alert_1 = 1,
    		Alert_2 = 2,
    		...
    	}
    
    	// Define an activatable class that is visible in JS
    	public ref class AnimType sealed
    	{ 
    		static property int Anim_1
    		{
    			int get() { return 0; }
    		}
    		static property int Anim_2
    		{
    			int get() { return 1; }
    		}
    		....
    	};
    }

    Wednesday, February 29, 2012 8:12 AM

Answers

All replies