【问题标题】:javascript file cordova.. how to pass value through variablejavascript文件cordova ..如何通过变量传递值
【发布时间】:2015-08-17 10:25:38
【问题描述】:

我正在开发英特尔科尔多瓦应用程序... 从服务器下载文件,我已经包含了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 plugin link 如果您对此有所了解,请回复...

【问题讨论】:

    标签: javascript android jquery cordova


    【解决方案1】:

    按照您提供的链接中的示例,从 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);
            });
        });
    },
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-10-19
      • 2014-11-07
      • 2018-06-28
      • 2011-07-23
      • 1970-01-01
      • 1970-01-01
      • 2021-08-01
      • 1970-01-01
      相关资源
      最近更新 更多