Created
October 1, 2014 14:01
-
-
Save HarryR/239679436a0de5941cd5 to your computer and use it in GitHub Desktop.
SockJS externs for Haxe/JS
This file contains 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
typedef SockJS_Options = { | |
@:optional var debug: Bool; | |
@:optional var devel: Bool; | |
@:optional var server: String; | |
@:optional var protocols_whitelist: Array<String>; | |
}; | |
extern class SockJS { | |
// Constants | |
static inline var CONNECTING: Int = 0; | |
static inline var OPEN: Int = 1; | |
static inline var CLOSING: Int = 2; | |
static inline var CLOSED: Int = 3; | |
public function new (url:String, ?_reserved:Dynamic, ?options:SockJS.SockJS_Options) : Void; | |
// State | |
public var readyState(default,null) : Int; | |
public var protocol(default,null) : String; | |
public var version(default,null) : String; | |
// Callbacks | |
public var onopen(default,default) : Void -> Void; | |
public var onclose(default,default) : Void -> Void; | |
public var onheartbeat(default,default) : Void -> Void; | |
public var onmessage(default,default) : Dynamic -> Void; | |
// Methods | |
public function close (code:Int = 1000, reason:String = "Normal closure") : Bool; | |
public function send (data:Dynamic) : Bool; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment