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; | |
| import haxe.Timer; | |
| import js.Node; | |
| /** | |
| * SlowServer | |
| * @author AxGord | |
| */ | |
| class SlowServer { |
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; | |
| import pony.net.SocketClient; | |
| import pony.net.SocketServer; | |
| class StringSocketExample | |
| { | |
| static function 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
| import pony.net.http.HttpServer; | |
| import pony.net.http.IHttpConnection; | |
| class HttpServerExample { | |
| static function main() { | |
| new HttpServer().request = function(connection:IHttpConnection) { | |
| connection.sendText('Hello world'); | |
| }; | |
| } | |
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
| Neko | |
| Main.hx:27: 224.676000595093 | |
| Main.hx:40: 356.434999465942 | |
| Cpp (32bit) | |
| Main.hx:27: 20.1340007781982 | |
| Main.hx:40: 106.84700012207 | |
| C# (64bit) | |
| Main.hx:27: 15.3541984558105 | |
| Main.hx:40: 234.727904319763 | |
| Java |
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; | |
| import pony.Priority; | |
| import haxe.Constraints.Function; | |
| #if (cs||java) | |
| typedef Listener1<T1> = {args:Int, f:T1->Void}; | |
| #else | |
| typedef Listener1<T1> = T1->Void; | |
| #end |
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; | |
| import pony.events.Signal; | |
| /** | |
| * ... | |
| * @author AxGord <axgord@gmail.com> | |
| */ | |
| class SignalTest { | |
| static function 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
| macro public function add(th:Expr, f:Expr, ?priority:ExprOf<Int>):Expr { | |
| if (priority == null) priority = macro 0; | |
| return switch Context.typeExpr(f).t { | |
| case TFun(args, ret): | |
| switch ret { | |
| case TAbstract(t, p): | |
| var n = t.get().name; | |
| if (n != 'Bool' && n != 'Void') | |
| Context.fatalError('Wrong return type', Context.currentPos()); |
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
| static function streamToString() { | |
| var streamInput = new Event1<Int>(); | |
| var streamOutput:Signal1<Int> = streamInput; | |
| var subStream = streamOutput.convert1( | |
| function(e:Event1<String>, v:Int) e.dispatch(v == 2 ? 'two' : Std.string(v)) | |
| ); | |
| subStream.add(function(s:String) trace(s)); | |
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 pixi.core.graphics.Graphics; | |
| import pixi.core.sprites.Sprite; | |
| import pixi.core.textures.Texture; | |
| import pony.time.DeltaTime; | |
| class Container extends Sprite { | |
| private var _bunny:Sprite; | |
| public function new(width:Float, height:Float) { |
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 LinkDemo implements pony.magic.HasLink { | |
| static var index:Int = 5; | |
| static var visualIndex(link, never):String = Std.string(index + 1); | |
| static function main() { | |
| trace(visualIndex);//=>6 | |
| index = 10; | |
| trace(visualIndex);//=>11 | |
| } |