1
У меня есть этот Try класс:методов вызова в функции обратного вызова
function Try() {
console.log('Start')
this.Something(function() {
console.log('asd')
this.Some()
})
}
Try.prototype.Something = function (callback) {
console.log('hi all')
callback()
}
Try.prototype.Some = function() {
console.log('dsa')
}
Но когда я пытаюсь вызвать некоторый метод в обратном вызове части, он дает мне ошибку, которая говорит this.Some is not a function
. В чем проблема? Как я могу это исправить?
или '.bind' анонимный function to 'this' –
Спасибо за быстрые ответы! :) – Joe
@Joe проверить привязку, а также https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_objects/Function/bind#Creating_a_bound_function – gurvinder372