mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-02-06 23:14:58 +00:00
Add support TypeScript
This commit is contained in:
parent
085d68d7ed
commit
4d734fb58e
|
@ -31,6 +31,7 @@ WelsonJS - Build a Windows desktop apps with JavaScript, HTML, and CSS based on
|
||||||
- [module.exports](https://nodejs.org/en/knowledge/getting-started/what-is-require/), CommonJS, UMD compatibility
|
- [module.exports](https://nodejs.org/en/knowledge/getting-started/what-is-require/), CommonJS, UMD compatibility
|
||||||
- [NPM](https://www.npmjs.com/) compatibility
|
- [NPM](https://www.npmjs.com/) compatibility
|
||||||
- [CoffeeScript 2](https://coffeescript.org/)/[LiveScript](https://livescript.net/) compatibility
|
- [CoffeeScript 2](https://coffeescript.org/)/[LiveScript](https://livescript.net/) compatibility
|
||||||
|
- [Typescript](https://www.typescriptlang.org/) compatibility
|
||||||
- Ready to use on Windows machine immediately. No require additional softwares installation.
|
- Ready to use on Windows machine immediately. No require additional softwares installation.
|
||||||
|
|
||||||
## Included libraries
|
## Included libraries
|
||||||
|
|
10
app.js
10
app.js
|
@ -239,7 +239,7 @@ function require(FN) {
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ".ts" // TypeScript (Testing)
|
case ".ts": // TypeScript
|
||||||
T = require.__modernie__("app/assets/js/typescript-4.9.4", [T], function(p, w, d) {
|
T = require.__modernie__("app/assets/js/typescript-4.9.4", [T], function(p, w, d) {
|
||||||
return w.ts.transpile(p[0]);
|
return w.ts.transpile(p[0]);
|
||||||
});
|
});
|
||||||
|
@ -341,13 +341,13 @@ require.__modernie__ = function(FN, params, callback) {
|
||||||
|
|
||||||
var exports = null;
|
var exports = null;
|
||||||
try {
|
try {
|
||||||
var IEVersion, T = '', htmlfile = CreateObject("htmlfile");
|
var ua = '', T = '', htmlfile = CreateObject("htmlfile");
|
||||||
|
|
||||||
htmlfile.write('<meta http-equiv="X-UA-Compatible" content="IE=edge">');
|
htmlfile.write('<meta http-equiv="X-UA-Compatible" content="IE=edge">');
|
||||||
htmlfile.write('<script type="text/javascript">//<!--<![CDATA[\nwindow.__getIEVersion__=function(){for(var e,i=3,n=document.createElement("div"),t=n.getElementsByTagName("i");n.innerHTML="<!--[if gt IE "+ ++i+"]><i></i><![endif]-->",t[0];);return i>4?i:e};\n//]]>--></script>');
|
htmlfile.write('<script type="text/javascript">//<!--<![CDATA[\n\nfunction __getUserAgent__(){return window.navigator.userAgent}\n\n//]]>--></script>');
|
||||||
IEVersion = htmlfile.parentWindow.__getIEVersion__();
|
ua = htmlfile.parentWindow.__getUserAgent__();
|
||||||
|
|
||||||
if (typeof IEVersion !== "undefined" && IEVersion > 9) {
|
if (ua.indexOf('Trident/ ')) {
|
||||||
T = require.__load__("app/assets/js/core-js-3.26.1.minified.js")
|
T = require.__load__("app/assets/js/core-js-3.26.1.minified.js")
|
||||||
+ "\n\n" + require.__load__("app/assets/js/modernizr-2.8.3.min.js")
|
+ "\n\n" + require.__load__("app/assets/js/modernizr-2.8.3.min.js")
|
||||||
+ "\n\n" + require.__load__("app/assets/js/babel-standalone-7.20.6.min.js")
|
+ "\n\n" + require.__load__("app/assets/js/babel-standalone-7.20.6.min.js")
|
||||||
|
|
7
helloworld.ts
Normal file
7
helloworld.ts
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
let message: string = 'Hello, World!';
|
||||||
|
|
||||||
|
function main(args) {
|
||||||
|
console.log(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.main = main;
|
Loading…
Reference in New Issue
Block a user