我用一個Cordova plugin其中有兩個回調函數:調用函數拋出錯誤的角度
window.plugins.screensize.get(this.screensize_success, this.screensize_error);
接下來,在成功回調,我做的:
screensize_success(result)
{
console.log(result); // <--- works fine
console.log("##### height: "+result.height); // <--- works fine
this.get_highest(result); // <--- throws an error
}
get_highest(result)
{
return Math.max(result.height,result.width);
}
我得到這個錯誤:
Uncaught (in promise): TypeError: Cannot read property 'get_highest' of null
我在做什麼錯?