This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package thx.core; | |
import haxe.Constraints.IMap; | |
@:multiType(K) | |
abstract MapList<K, V>(MapListImpl<K, V>) { | |
public function new(); | |
public inline function set(key:K, value:V) this.set(key, value); | |
public inline function insert(index : Int, k : K, v : V) : Void this.insert(index, k, v); | |
@:arrayAccess public inline function get(key:K) return this.get(key); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import restx.App; | |
class Main implements restx.IRoute { | |
@:path("/") | |
function index() | |
response.send("Hello World!"); | |
public static function main() { | |
var app = new App(9998); | |
app.router.register(new Main()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@:use(mw.BodyParser.json()) | |
class Auth implements abe.IRoute { | |
@:post("/auth") | |
@:args(body) | |
function login(user : String, password : String) { | |
response.send('$user:$password'); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import express.Request; | |
import express.Response; | |
import express.Next; | |
import express.Middleware; | |
import express.Express; | |
import abe.Router; | |
class Main { | |
public static function main() { | |
var router = new abe.Router(null); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import js.Promise; | |
class Main { | |
static function main() { | |
var p1 = new Promise(function(resolve, reject) { | |
resolve("YES"); | |
}); | |
p1.then(function(v) trace(v), function(e) trace('NOOO!! $e')); | |
var p2 = new Promise(function(resolve, reject) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import js.node.vm.Script; | |
using thx.promise.Promise; | |
class Lazy { | |
static var map : Map<String, Script> = new Map(); | |
public static function load(path : String) : Promise<{} -> String> { | |
var script = map.get(path); | |
if(null != script) { | |
return Promise.value(loadScript(script)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private typedef _SActionFunc = EntityScript -> _SA -> Void; | |
private class _SActions { | |
// Every function in this class must be of type _SActionFunc. | |
// Who knows what will happen if this is not true. | |
public static function Idle(entity:EntityScript, action:_SA):Void { | |
} | |
public static function AnotherAction(entity:EntityScript, action:_SA):Void { | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package bl.common; | |
using thx.promise.Promise; | |
import thx.Url; | |
import js.html.XMLHttpRequest; | |
import js.html.XMLHttpRequestResponseType; | |
class Request<T> { | |
public var response(default, null) : Promise<T>; | |
var request : XMLHttpRequest; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import abe.App; | |
import bl.server.*; | |
import js.Node.*; | |
import js.node.Cluster; | |
import js.node.Os; | |
import npm.Chalk.*; | |
class Server { | |
public static var defaultPort(default, null) = 8787; | |
public static var defaultHost(default, null) = "0.0.0.0"; |