Start a new topic

Require.js features

It says support to generate code for Require.js... What is that all about?


Cant find any details on the built in features for using Require.js

1 Comment

You can specify AMD (RequireJS) module for target assembly in DuoCode, very similar to TypeScript module system support.

You have 3 ways to specify it in your project:


1) using Project-Properties>DuoCode tab (the most convinient way)

2) manually specify msbuild project property <DuoCodeModuleKind>Amd</DuoCodeModuleKind>

3) dcc.exe /module:amd argument


Later in JS you can dynamically load the JS-module ("assembly"):

    

assembly = require("./myCsharpProject.js"); // very similar to Assembly.Load("myCsharpProject.dll") in C#
var class1 = new myCsharpNamespace.Class1.ctor(); // new we can create some class

    

To load JS module in C# you can also use Js.require(), see NodejsWebApp template code on how to do this.


Hope this helps.

Login or Signup to post a comment