私はこのシンプルなスニペットを持っています。あまりに単純ではありません。私は接続の仕方を知る必要がありました。感謝。何を知るためのコード?
function Container(connectionString) {
var dataFetched = true;
var dbConnection = DbConnection(connectionString);
}
Container.prototype.getData = function() {
if (!this.dataFetched)
throw "Data not fetched!";
return this.data;
}
Container.prototype.fetch = function() {
this.dbConnection.getAllData(function (err, result) {
if (err) {
delete this.data;
this.dataFetched = false;
return false;
} else {
this.data = result;
this.dataFetched = true;
return true;
}
});
}
function DbConnection(connectionString) { }
あなたが何を求めているのかよく分かりません。これは、あなたが何を尋ねているのかを、offtopicまたは不明瞭にする必要があります。 –
このコードはどれかのタグを知りたいだけですか?私はこの '* .prototype。*'のものを見たことがありません。 – rockStar
@rockStarプロトタイプの継承! –