javascript文件cordova ..如何通过变量传递值

我正在开发intel cordova应用程序…从服务器下载文件,我已经包含了cordova文件下载插件,但它有我希望通过变量传递的数据…这是我的代码:

var app = { fileName: "PointerEventsCordovaPlugin.wmv", //<-- pass this value through variable (dynamic) uriString: "http://media.ch9.ms/ch9/8c03/f4fe2512-59e5-4a07-bded-124b06ac8c03/PointerEventsCordovaPlugin.wmv", // <-- this one also // Application Constructor initialize: function() { this.bindEvents(); }, 

….我已经添加了fileName和uristring ..但我想从变量动态添加该值..我怎么能这样做????? cordova插件链接,如果您对此有任何了解,请回复…

按照您提供的链接示例,从app对象中删除fileNameuriString字段,并参数化所需的函数。 例如,startDownload将变为:

 startDownload: function (fileName, uriString) { window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSystem) { fileSystem.root.getFile(fileName, { create: true }, function (newFile) { app.downloadFile(uriString, newFile); }); }); },