Giter Site home page Giter Site logo

Packaged qooxdoo.js about qx-typed HOT 4 CLOSED

vegansk avatar vegansk commented on July 23, 2024
Packaged qooxdoo.js

from qx-typed.

Comments (4)

tcsaddul avatar tcsaddul commented on July 23, 2024

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.

from qx-typed.

vegansk avatar vegansk commented on July 23, 2024

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.

from qx-typed.

vegansk avatar vegansk commented on July 23, 2024

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...

from qx-typed.

jbaron avatar jbaron commented on July 23, 2024

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;
...
}


from qx-typed.

Related Issues (11)

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.