From ad0d4409cffe46a18eb3bfd892592b6ec8f932b2 Mon Sep 17 00:00:00 2001 From: RblSb Date: Wed, 20 May 2020 22:39:09 +0300 Subject: Update to Haxe 4.1 --- README.md | 3 ++- build-all.hxml | 3 --- build-client.hxml | 6 +++--- build-server.hxml | 14 +++++++------- build/server.js | 26 ++++++++++---------------- res/client.js | 2 +- src/server/Utils.hx | 6 ++---- 7 files changed, 25 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index 56558cb..3671b47 100644 --- a/README.md +++ b/README.md @@ -45,8 +45,9 @@ It's just works, but you can also check [user/ folder](/user/README.md) for serv - Add `APP_URL` config var with `your-app-link.herokuapp.com` value to prevent sleeping when clients online ### Development -- Install Haxe 4, VSCode and vshaxe extension +- Install [Haxe 4.1](https://haxe.org/download/), [VSCode](https://code.visualstudio.com) and [Haxe extension](https://marketplace.visualstudio.com/items?itemName=nadako.vshaxe) - `haxelib install all` to install extern libs +- If you skipped `Setup` section before: `npm install` - Open project in VSCode and press `F5` for client+server build and run ### About diff --git a/build-all.hxml b/build-all.hxml index 8e9fb78..f9c3663 100644 --- a/build-all.hxml +++ b/build-all.hxml @@ -1,7 +1,4 @@ --each - build-client.hxml - --next - build-server.hxml diff --git a/build-client.hxml b/build-client.hxml index 7d2e943..01f9365 100644 --- a/build-client.hxml +++ b/build-client.hxml @@ -1,6 +1,6 @@ --lib youtubeIFramePlayer:git:https://github.com/okawa-h/youtubeIFramePlayer-externs.git --lib hls.js-extern:git:https://github.com/grosmar/hls.js-haxe-extern.git --cp src +--library youtubeIFramePlayer:git:https://github.com/okawa-h/youtubeIFramePlayer-externs.git +--library hls.js-extern:git:https://github.com/grosmar/hls.js-haxe-extern.git +--class-path src --main client.Main -D analyzer-optimize --dce full diff --git a/build-server.hxml b/build-server.hxml index abca82d..c526317 100644 --- a/build-server.hxml +++ b/build-server.hxml @@ -1,11 +1,11 @@ --lib hxnodejs --lib hxnodejs-ws --lib json2object +--library hxnodejs +--library hxnodejs-ws +--library json2object # Client libs for completion --lib youtubeIFramePlayer:git:https://github.com/okawa-h/youtubeIFramePlayer-externs.git --lib hls.js-extern:git:https://github.com/grosmar/hls.js-haxe-extern.git --lib utest --cp src +--library youtubeIFramePlayer:git:https://github.com/okawa-h/youtubeIFramePlayer-externs.git +--library hls.js-extern:git:https://github.com/grosmar/hls.js-haxe-extern.git +--library utest +--class-path src --main server.Main -D analyzer-optimize --dce full diff --git a/build/server.js b/build/server.js index 02b5503..7d2a7dd 100644 --- a/build/server.js +++ b/build/server.js @@ -1,4 +1,4 @@ -// Generated by Haxe 4.1.0+9cbc59342 +// Generated by Haxe 4.1.0 (function ($global) { "use strict"; var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; function $extend(from, fields) { @@ -4025,26 +4025,20 @@ server_Utils.getLocalIp = function() { return "127.0.0.1"; }; server_Utils.sortedPush = function(ids,id) { - var _g = 0; - var _g1 = ids.length; - while(_g < _g1) { - var i = _g++; - if(id < ids[i]) { - ids.splice(i,0,id); - return; - } + var _g_current = 0; + while(_g_current < ids.length) if(id < ids[_g_current++]) { + ids.splice(_g_current - 1,0,id); + return; } ids.push(id); }; server_Utils.shuffle = function(arr) { - var _g = 0; - var _g1 = arr.length; - while(_g < _g1) { - var i = _g++; + var _g_current = 0; + while(_g_current < arr.length) { + var _g1_value = arr[_g_current++]; var n = Std.random(arr.length); - var a = arr[i]; - arr[i] = arr[n]; - arr[n] = a; + arr[_g_current - 1] = arr[n]; + arr[n] = _g1_value; } }; var server_VideoTimer = function() { diff --git a/res/client.js b/res/client.js index 307266e..e29233e 100644 --- a/res/client.js +++ b/res/client.js @@ -1,4 +1,4 @@ -// Generated by Haxe 4.1.0+9cbc59342 +// Generated by Haxe 4.1.0 (function ($hx_exports, $global) { "use strict"; $hx_exports["client"] = $hx_exports["client"] || {}; $hx_exports["client"]["JsApi"] = $hx_exports["client"]["JsApi"] || {}; diff --git a/src/server/Utils.hx b/src/server/Utils.hx index 4764751..abce1c0 100644 --- a/src/server/Utils.hx +++ b/src/server/Utils.hx @@ -35,8 +35,7 @@ class Utils { } public static function sortedPush(ids:Array, id:Int):Void { - for (i in 0...ids.length) { - final n = ids[i]; + for (i => n in ids) { if (id < n) { ids.insert(i, id); return; @@ -46,9 +45,8 @@ class Utils { } public static function shuffle(arr:Array):Void { - for (i in 0...arr.length) { + for (i => a in arr) { final n = Std.random(arr.length); - final a = arr[i]; final b = arr[n]; arr[i] = b; arr[n] = a; -- cgit v1.2.3