私は道場にかなり慣れていないので、コールバックを処理するために lang.hitch メソッドを使用しようとしていますが、使用すると「Uncaught Reference Error: is not defined error」というエラーが発生し続けます。私は何か間違ったことをしていると確信しています-それが何であるかはわかりません。 this
コードをステップ実行したときに検証された、initializeLocators 関数で新しく作成したオブジェクトを参照します。showResults メソッドへの候補パラメータは、イベント処理クロージャから返されます。ご協力いただきありがとうございます。
私のクラス:
define(["dojo/_base/declare", ..., "dojo/_base/lang", "dojo/on", "dojo/dom", ...],
function(declare, ..., lang, ...){
var SDCLocateClass = declare(null, {
...,
constructor: function() {
this.initializeLocators();
},
initializeLocators: function() {
this.addressNode = dom.byId("resultsDiv");
//set up the address locator functionality
this.locator = new Locator("http://...");
this.locator.on("address-to-locations-complete", lang.hitch(this, showResults));
},
showResults: function(candidates) {
...
},
});
return SDCLocateClass;
});