Skip to content
andyli edited this page Dec 17, 2012 · 17 revisions

Haxe 3

Haxe 3

The haxe3 branch includes experimental support to the not-yet-released Haxe 3.

New module structure

Individual jQuery classes are now split into their own modules(files) instead of living in the single jQuery.JQuery module.

They can now be easily accessed by

import jQuery.*; //previously `import jQuery.JQuery;`

Plugin system

A jQuery.Plugin class is introduced for writing jQuery plugin extern. It is macro-based, responsible for copy-and-pasting the fields in the extern classes into jQuery.JQuery and jQuery.JQueryStatic.

To write a jQuery plugin extern, create an extern class that extends jQuery.Plugin, and start writing the members as if writing directly inside the jQuery.JQuery/jQuery.JQueryStatic class.

package com.testing.MyJQueryPlugIn;

extern class MyJQueryPlugIn extends Plugin {
    //instance members will go to `jQuery.JQuery`
    public function myMethod(arg:Dynamic):JQuery;
    
    //static members will go to `jQuery.JQueryStatic`
    static public function myStaticMethod(arg:Dynamic):JQueryStatic;
}

To use it, add the following compiler option:

--macro jQuery.Plugin.add('com.testing.MyJQueryPlugIn')
Clone this wiki locally