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
| class Test { | |
| static function main() { | |
| var req = makeRequest(Foo, r -> trace(r.foo)); | |
| req.send(); | |
| var req2 = makeRequest(Bar(42), r -> trace(r.answer)); | |
| req2.send(); | |
| } | |
| static function makeRequest<T>(endpoint:Endpoint<T>, handler:T->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
| import cs.system.collections.generic.IEnumerator_1; | |
| import cs.system.collections.generic.KeyValuePair_2; | |
| import cs.system.collections.generic.Dictionary_2; | |
| using Main; | |
| @:nativeGen class Main { | |
| public static function main() { | |
| var dict = new Dictionary_2<String, String>(); | |
| dict.Add('hello', 'world'); |
Because I have no trust in people.
<hashlink>points to your installation of Hashlink, e.g. folder in whichhl.exe(or Unix executable) is, alongside with library binaries (.hdllfiles), andincludefolder.<src>points to the folder containing generated HL/C sources. One that containshlc.jsonfile.<app>refers to your output executable name, including extension.<main>refers to your entry-point file name, including extension (see below).- I provide example of doing it on Windows via MSVC
cl.exe, but Unix should be more or less same with replacement of argument flags and compiler. - I expect that you DO have a compiler installed and can call
cl.exeor other compiler from command-line.
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 apollo.client.ApolloClient; | |
| import apollo.cache.inmemory.InMemoryCache; | |
| import apollo.link.ApolloLink; | |
| import apollo.link.http.HttpLink; | |
| import apollo.link.error.ErrorLink; | |
| import apollo.link.error.ErrorResponse; | |
| class DefaultClient extends ApolloClient<Any> { | |
| public function new(uri:String) { | |
| super({ |
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
| <div className="App"> | |
| <header className="App-header"> | |
| <img src=$logo className="App-logo" alt="logo" /> | |
| <p> | |
| Edit <code>src/App.hx</code> and save to reload. | |
| </p> | |
| </header> | |
| </div> |
-
Place
lix-to-installandlix-to-haxelibin a directory being in your$PATH(~/.binfor example, which you may have to add to your$PATH) and chmod them withchmod +x. -
Generate a
install.hxmlfile by running this in your project:lix-to-install > install.hxml -
Install dependencies via haxelib (needs HaxeFoundation/haxelib#456):
haxelib install --skipdeps --always install.hxml
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
| class Test { | |
| static function main() { | |
| var a:Extends<A> = extended({a: "hello", b: "world"}); | |
| $type(a); // Extends<A> | |
| trace(haxe.Json.stringify(a)); | |
| a.a = "bye"; | |
| // a.a = 42; // Int should be String | |
| // a.b = "nope"; // Extends<A> has no field b | |
| trace(haxe.Json.stringify(a)); |