0
var qx = require('qooxdoo');
var t= new T(4080);
var t= new qx.T(4080);
// none of them are defined :s

メイン ファイル run.js と、クラスを持つファイル T.js があります。

qx.Class.define("T", {
    extend : qx.core.Object,

    constructor: function(port){
        debugger;
        var self = this;
        this.port = port;
        this.server = http.createServer(function(req, res){
            self.onRequest.apply(self, arguments);
        });
        server.listen(port);
    },

    members : {
        onRequest: function(req, res){
            debugger;
            util.log('requested!');
        }
    }
 });

何か足りない?

http://manual.qooxdoo.org/1.6/pages/server/overview.html ここでは、同じファイル内でのみ、他のファイルの使用方法については述べていません..だから、どうすればいいのかわかりません..

どんな助けでも大歓迎です、ありがとう(:

4

1 に答える 1

2

T.js ファイルを実行する部分がありません (必要なため)。たとえば、次のようなものが機能します。

app.js:

var qx = require('qooxdoo');
require('./class-t'); // Run the file that creates the class.

var t = new T();
t.foo(); // logs "T#foo called"

クラス-t.js:

var qx = require('qooxdoo');

qx.Class.define('T', {
  extend: qx.core.Object,

  members: {
    foo: function () {
      console.log('T#foo called');
    }
  }
});
于 2012-04-05T09:51:33.783 に答える