0
以下のコードを理解するために何が起こっているのか、また何かリンクを説明できますか?ここでJavascriptの匿名機能がオブジェクトを追加しています
function createApplication() {
var app = function(req, res, next) {
app.handle(req, res, next);
};
mixin(app, EventEmitter.prototype, false);
mixin(app, proto, false);
// expose the prototype that will get set on requests
app.request = Object.create(req, {
app: { configurable: true, enumerable: true, writable: true, value: app }
})
// expose the prototype that will get set on responses
app.response = Object.create(res, {
app: { configurable: true, enumerable: true, writable: true, value: app }
})
app.init();
return app;
}
アプリの種類は、関数であるが、他のオブジェクトが割り当てられている場合、その後復帰した後、これらのオブジェクトにアクセスする方法
をこれらのオブジェクトは –
おかげ値にアクセスする方法を、あなたは名前の機能上のゲッターとセッターについてご説明しながら、混乱させ、ゲッターとしてのオブジェクトを割り当て、私は編集を行いました。基本的にJS関数はオブジェクトなので、独自のプロパティ(この場合は 'request')を持つことができるので、app.requestを使ってアクセスすることができます。 – GibboK
ありがとうございました –