-1
我无法弄清楚是什么让我的功能无法启动。我在Appcelerator Studio上编写代码,并有四个js文件供我使用。这是不会触发的函数之一的代码。为什么我的javaScript函数不能触发?
app.js文件
var ui = require("win");
var geo = require("geo");
geo.getGeo;
geo.js文件
var getGeo = function() {
console.log("Geo Module");
Ti.Geoloaction.purpose = "Your location is needed to get your weather forecast.";
Ti.Geolocation.getCurrentPosition(function(a){
console.log(a);
console.log(JSON.stringify(a.source));
var userLoc = {
lat : a.cords.latitude,
lng : a.cords.longitude
};
});
//win.buildGeoUi;
net.netFnc;
console.log(userLoc.lat, userLoc.lng);
};
exports.getGeo = getGeo;
这是一所学校项目的天气应用程序。我也试图从嵌套在函数中的api中提取数据。
当我运行我的应用程序console.logs时,我的getGeo函数内部没有运行,这是我知道它不会触发函数。
你需要一些括号来调用函数'getGeo()' –
谢谢!我知道这是轻微的疏忽,但我无法为我的生活弄清楚它! – RBnoob