Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packaged qooxdoo.js #6

Closed
vegansk opened this issue Dec 11, 2014 · 4 comments
Closed

Packaged qooxdoo.js #6

vegansk opened this issue Dec 11, 2014 · 4 comments

Comments

@vegansk
Copy link

vegansk commented Dec 11, 2014

Thank you for that project. Qooxdoo development is much easier with typescript.

Can you give some information about the building of qooxdoo.js lib? I can make similar package using source-hybrid goal from some application for example. But qx.registry.registerMainMethod is not a qooxdoo function. How this function works?

@tcsaddul
Copy link

If you look at the file "Application.ts", you will see at the bottom the following line:

qx.registry.registerMainMethod(qooxdooMain);

You will observe, that it sits outside any class or function so that it will be executed when the transpiled Javascript is loaded. Just make sure the qooxdoo.js is loaded first.

@vegansk
Copy link
Author

vegansk commented Dec 11, 2014

The question is not when this function will be called. For example, I want to use qooxdoo mobile with typescript. In that case, I need qooxdoo.js with another implementation of qx.registry.registerMainMethod. So, the question is how to white the bootstrap similar to registerMainMethod.

@vegansk
Copy link
Author

vegansk commented Dec 11, 2014

Found the solution. Thanks to JSBeautify :-) Application.js:

var a = "__app",
      b = "__method",
      c = "base.Application";
qx.registry = {
    registerMainMethod: function(d) {
      qx.registry[b] = d;
      var e = qx.registry[a];
      if (e) d(e);
    },
    registerApp: function(f) {
      qx.registry[a] = f;
      var g = qx.registry[b];
      if (g) g(f);
    }
};

plus in main:

qx.registry.registerApp(this);
qx.ui.basic.Atom;
qx.ui.basic.Image;
qx.ui.basic.Label;
// And so on...

@vegansk vegansk closed this as completed Dec 11, 2014
@jbaron
Copy link
Owner

jbaron commented Dec 12, 2014

See you figured it out your self. But indeed there are two parts:

  1. The registration method for the main. Done this so it makes no difference if you first load your own javascript of first load qooxdoo library.

qx.registry = {
    registerMainMethod : function(mainMethod) {
                qx.registry["__method"] = mainMethod;
        var app = qx.registry["__app"]; 
        if (app) mainMethod(app);
    },

    registerApp : function(app) {
        qx.registry["__app"] = app;
        var method = qx.registry["__method"];
        if (method) method(app); 
    }

};

  1. Trick the compiler by including all the required classes. Please note that these are in a clause that will never be executed. Just so the qooxdoo tools put all these classes in the resulting javascript file.
var aaa = 12 * 32 / 5 + 4;
if (aaa===0) {
   qx.ui.basic.Atom;
   qx.ui.basic.Image;
   qx.ui.basic.Label;
   qx.ui.container.Composite;
...
}


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants