Hello!
I know I've already asked a question about server-side js, but now as I use
the OO part of qooxdoo (what it's supposed to be used on the server) I find
2 problems:
- How should I organize my code in order to use them on both on server and
on the client? I would like to don't have to copy-paste files or code from a
folder containing only server to the client or viceversa. I don't even need
all the code from the server on the client and viceversa.
- I'm using "require" to get classes available to the program, but are
relative from where I need them so I have to take care that it's the right
way to require them every time. I have to repeat things: once in the require
and the other when I use the code; I'm asking if it's possible to make some
absolute require? require('/myapp/abc') instead of require('./abc') if I'm
in requiring it from the myapp folder or require('./myapp/abc') if I'm
requiring it from the root folder. I can provide an alternative idea:
instead of using "things" like this:
var a = new qx.core.Aspect();
use:
// in the beginning of the program
qx.Class.define("myapp.class", [
// uses
'qx.core.Aspect'
], function(u){
//here we put extend, construct, properties and members
this.members = {
myMethod: function(){
var a = new u.Aspect();
// or
var b = new u.qx.core.Aspect();
// or
var c = new u['qx.core.Aspect']();
// or you could define an alias for that in the "uses" section
// instead of ['qx.core.Aspect'] write [['qx.core.Aspect',
'myAlias']]
var d = new u.myAlias();
}
}
}
the qooxdoo class should abstract the "require" part from the end user by
using a closure that it's run only when files are loaded. I can provide a
more "real" example of what I mean if interested.
but it's just a suggestion, and both ways can coexists.
Thanks for your time and for reading this,
--
View this message in context:
http://qooxdoo.678.n2.nabble.com/Reusing-server-side-code-in-the-client-side-how-to-get-rid-of-the-require-in-nodejs-suggestion-tp7452919p7452919.html
Sent from the qooxdoo mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel