I created a WinJS-Application [Windows-10-UWP] converted the code to Typescript.
Now I have a Windows-Runtime-Component, which I want to refer to in my .ts files.
I allready achieved this in the normal javascript by following the instructions given here. But I have no idea to achieve this in Typescript. The main problem here is, that I am not able to create a reference to the Window-Runtime Component. Is this even possible?
Add a comment
|
1 Answer
The main problem here is, that I am not able to create a reference to the Window-Runtime Component. Is this even possible?
Yes, it is possible. If you have referenced the Windows Runtime Component in your main project. The namespace will be stored in the global window object. So you can access the Windows Runtime Component like below:
let variable= window["MyTestComponent"];
3 Comments
TheTanic
Thank you for your reoly. I will Test it as soon as possible
TheTanic
It works, but i get the message that there is a typedef missing and i don't know which type is needed here.
Elvis Xia - MSFT
use
any type: let variable:any=window["MyTestComponent"].