Skip to content

Instantly share code, notes, and snippets.

package ember;
import haxe.macro.Expr;
import haxe.macro.Context;
@:autoBuild(ember.GetterSetterBuilder.build())
@:native("Ember.Object")
extern class Object {
public function new():Void;
package ember;
@:native("Ember.StateManager")
extern class StateManager extends State {
public function new():Void;
public var enableLogging:Bool;
/**
package ember;
import haxe.macro.Expr;
import haxe.macro.Context;
@:autoBuild(ember.GetterSetterBuilder.build())
@:ember @:native("Ember.Object")
extern class Object {
public function new():Void;
package ;
import haxe.macro.Compiler;
import haxe.macro.Context;
import haxe.macro.ExampleJSGenerator;
import haxe.macro.JSGenApi;
import haxe.macro.Type;
import haxe.macro.Expr;
using Lambda;
class EmberJSGenerator extends ExampleJSGenerator {
MyApp.views.FriendSelectorView = $hxClasses['MyApp.views.FriendSelectorView'] = Ember.View.extend();
MyApp.views.FriendSelectorView.prototype.friendsBinding = null;
MyApp.views.FriendSelectorView.prototype.friends = null;
MyApp.views.FriendSelectorView.prototype.init = function() {
this._set_template(Ember.Handlebars.compile(haxe.Resource.getString("friendSelector.html")));
this._set_friendsBinding(Ember.Binding.single("MyApp.passController.friends"));
Ember.View.prototype.init.call(this);
};
MyApp.views.FriendSelectorView.prototype._get_friendsBinding = function() {
return this.get("friendsBinding");
private function hasSuperClass(c:ClassType, searchForClassType:ClassType) {
var superClass = c;
do {
superClass = superClass.superClass.t.get();
if (superClass == searchForClassType) return true;
} while (superClass != null);
return false;
}
private function hasSuperClass(c:ClassType, searchForClassType:String) {
var currentClassType = c;
do {
if (currentClassType.superClass != null) {
currentClassType = currentClassType.superClass.t.get();
if (currentClassType.pack.concat([currentClassType.name]).join(".") == searchForClassType) return true;
}
} while (currentClassType.superClass != null);
return false;
private String doSync(String operation, IClient client, RequestFunction function, AMFDataList params, String host, String data) {
StringBuffer resultBuffer = new StringBuffer();
HttpClient httpClient = null;
BufferedReader in = null;
OutputStreamWriter out = null;
try {
httpClient = new DefaultHttpClient();
httpClient.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_0); // disable chunking
extern class State {
public static function create(options:State):State;
@:optional public var route:String;
}
// I am aiming for type safety for something like:
var state = State.create({route:"Hello", somethingRandom: 1});
// If instead I do
class TypeTest {
public static function main() {
myFunc({});
myFunc({ a: "Hello" });
myFunc({ b: 1 });
myFunc({ another: "something" });
}
private static function myFunc(o:Opts):Void { }