Git Product home page Git Product logo

brackets-hx-externs's Introduction

Haxe externs for Brackets

Haxe externs for the Brackets editor (http://brackets.io). These externs can be used to create extensions for brackets.

Usage

To create a new extension all you have to do is create a subclass of the Extension class, override the initialize() method and then, in the Main() method, just instantiate the extension.

Example

The Hello-World extension from the Brackets wiki (https://github.com/adobe/brackets/wiki/Simple-%22Hello-World%22-extension) would look like this in Haxe:

class HelloWorldExtension extends Extension {
    private static inline var MYCOMMAND_ID = "helloworld.sayhello";

    public function new() { super(); }

    override public function initialize():Void {
        super.initialize();

        // Get the modules we will need.
        var commandManager:CommandManager = Brackets.getModule("command/CommandManager");
        var menus:Menus = Brackets.getModule("command/Menus");

        // Register our command with brackets so it will know about it when we click the
        // menu item which will be created below.
        commandManager.register("Hello World", MYCOMMAND_ID, this.handleHelloWorld);

        // Create a new menu item in the file menu and associate it with the command we created above.
        var menu:Menu = menus.getMenu(menus.AppMenuBar.FILE_MENU);
        menu.addMenuItem(MYCOMMAND_ID);
    }

    /**
     * Called when the user clicks the menu item that the extension creates.
     */
    public function handleHelloWorld():Void {
        Browser.window.alert("Hello, world!");
    }
}

And the Main would look like this:

class Main {
    public static function main():Void {
        var extension:Extension = new HelloWorldExtension();
    }
}

Notes

This is still very incomplete but should be enough to write some simple extensions. Please let me know if there is a certain API that you would like me to include. And, of course, pull requests are more than welcome.

brackets-hx-externs's People

Contributors

as3boyan avatar hccampos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

as3boyan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.