You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 24, 2022. It is now read-only.
Let's start discussion of this discussion in parallel to #532.
I believe that we need some convenient way to interact between translated C# code and JavaScript.
Main problem here is dynamic nature of JavaScript. On other hand, we now, that TypeScript lives with it, and even provide statically typed mapping files for many existing pure-JavaScript libraries.
We can begin with such *.d.ts files. If we will be able to map them to some C# interfaces (it should be roundtrip, so that we should be able map produced C# interfaces back), we'll be able to pass our C# objects implementing them as input parameters to C# methods - and treat method results as C# objects.
Really, here we have second problem - we can't use raw JS object as .Net interface implementer (and vice versa). So we need an adapters layer - 2 of them, for wrapping .Net object and export it to JavaScript and wrapping JavaScrpt object and exporting it to .Net.
We may need to view, how same interaction implemented in https://github.com/bridgedotnet/Bridge and probably discuss it with them - it would be only benefit for all of us if we'll have compatible interfaces mapping.
Looks like they have C# project, that is able to parse *.d.ts files - https://github.com/bridgedotnet/Retyped (other option would be write C# interface generators in TypeScript and use TypeScript compiler for extracting type information).
So, first step should be mapping of TypeScript interface to C#. Let's discuss it.
The text was updated successfully, but these errors were encountered:
iskiselev
changed the title
JsAPI: Adapters
JsAPI: Adapters and TypeScript
Dec 9, 2015
Looks like Wire formats (dotnet/roslyn#3910), that are in working list for C#7 (dotnet/roslyn#2136) with (Strong interest) mark could also help us solve JS-interop problem.
Let's start discussion of this discussion in parallel to #532.
I believe that we need some convenient way to interact between translated C# code and JavaScript.
Main problem here is dynamic nature of JavaScript. On other hand, we now, that TypeScript lives with it, and even provide statically typed mapping files for many existing pure-JavaScript libraries.
We can begin with such *.d.ts files. If we will be able to map them to some C# interfaces (it should be roundtrip, so that we should be able map produced C# interfaces back), we'll be able to pass our C# objects implementing them as input parameters to C# methods - and treat method results as C# objects.
Really, here we have second problem - we can't use raw JS object as .Net interface implementer (and vice versa). So we need an adapters layer - 2 of them, for wrapping .Net object and export it to JavaScript and wrapping JavaScrpt object and exporting it to .Net.
We may need to view, how same interaction implemented in https://github.com/bridgedotnet/Bridge and probably discuss it with them - it would be only benefit for all of us if we'll have compatible interfaces mapping.
Looks like they have C# project, that is able to parse *.d.ts files - https://github.com/bridgedotnet/Retyped (other option would be write C# interface generators in TypeScript and use TypeScript compiler for extracting type information).
So, first step should be mapping of TypeScript interface to C#. Let's discuss it.
The text was updated successfully, but these errors were encountered: