Skip to content

Commit

Permalink
Add @:selfCall to remove the generation of new.
Browse files Browse the repository at this point in the history
close #7
  • Loading branch information
andyli committed Mar 4, 2015
1 parent 64dc6fa commit e347842
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions jQuery/Callbacks.hx
Expand Up @@ -24,6 +24,7 @@ package jQuery;
/**
A multi-purpose callbacks list object that provides a powerful way to manage callback lists.
**/
@:selfCall
@:jQueryVersion({ added : "1.7" })
public function new(flags:String):Void;
/**
Expand Down
1 change: 1 addition & 0 deletions jQuery/Deferred.hx
Expand Up @@ -64,6 +64,7 @@ package jQuery;
/**
A constructor function that returns a chainable utility object with methods to register multiple callbacks into callback queues, invoke callback queues, and relay the success or failure state of any synchronous or asynchronous function.
**/
@:selfCall
@:jQueryVersion({ added : "1.5" })
public function new(?beforeStart:jQuery.Deferred -> Void):Void;
/**
Expand Down
9 changes: 9 additions & 0 deletions jQuery/JQuery.hx
Expand Up @@ -487,54 +487,63 @@ package jQuery;
/**
Accepts a string containing a CSS selector which is then used to match a set of elements.
**/
@:selfCall
@:overload
@:jQueryVersion({ added : "1.4" })
public function new():Void;
/**
Accepts a string containing a CSS selector which is then used to match a set of elements.
**/
@:selfCall
@:overload
@:jQueryVersion({ added : "1.0" })
public function new(element:js.html.Node):Void;
/**
Accepts a string containing a CSS selector which is then used to match a set of elements.
**/
@:selfCall
@:overload
@:jQueryVersion({ added : "1.0" })
public function new(elementArray:jQuery.haxe.Either<js.html.NodeList, Array<js.html.Node>>):Void;
/**
Accepts a string containing a CSS selector which is then used to match a set of elements.
**/
@:selfCall
@:overload
@:jQueryVersion({ added : "1.0" })
public function new(selection:jQuery.JQuery):Void;
/**
Binds a function to be executed when the DOM has finished loading.
**/
@:selfCall
@:overload
@:jQueryVersion({ added : "1.0" })
public function new(callback:haxe.Constraints.Function):Void;
/**
Accepts a string containing a CSS selector which is then used to match a set of elements.
**/
@:selfCall
@:overload
@:jQueryVersion({ added : "1.0" })
public function new(object:Dynamic):Void;
/**
Creates DOM elements on the fly from the provided string of raw HTML.
**/
@:selfCall
@:overload
@:jQueryVersion({ added : "1.4" })
public function new(html:String, attributes:Dynamic):Void;
/**
Accepts a string containing a CSS selector which is then used to match a set of elements.
**/
@:selfCall
@:overload
@:jQueryVersion({ added : "1.0" })
public function new(selector:String, ?context:jQuery.haxe.Either<js.html.Node, jQuery.JQuery>):Void;
/**
Creates DOM elements on the fly from the provided string of raw HTML.
**/
@:selfCall
@:overload
@:jQueryVersion({ added : "1.0" })
public function new(html:String, ?ownerDocument:js.html.Document):Void;
Expand Down
6 changes: 5 additions & 1 deletion jQuery/haxe/Config.hx
Expand Up @@ -197,7 +197,11 @@ class Config {
var newFields = [];
for (fields in fieldMap) {
var field = fields.pop();
field.meta = [];
field.meta = [
for (m in field.meta)
if (![":overload", ":jQueryVersion"].has(m.name))
m
];

var docMap = new Map<String,Void>();
if (field.doc != null)
Expand Down
8 changes: 8 additions & 0 deletions jQuery/haxe/gen/CoreExternGenerator.hx
Expand Up @@ -556,6 +556,14 @@ class CoreExternGenerator {

//sort
functions.sort(function(f0,f1) return compareFunctions(f0.func, f1.func));

if (memName == "new") {
field.meta.push({
name:":selfCall",
params:[],
pos: null
});
}

if (functions.length > 1) {
field.meta.push({
Expand Down

0 comments on commit e347842

Please sign in to comment.