javascript文件科尔多瓦..如何通过变量传递价值 [英] javascript file cordova.. how to pass value through variable

查看:113
本文介绍了javascript文件科尔多瓦..如何通过变量传递价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发英特尔科尔多瓦应用程序... 从服务器下载文件时,我已经包括科尔多瓦文件下载的插件,但它有,我想通过可变数据... 这里是我的code:

I am developing intel cordova app... to download files from server , i have included cordova file download plugin but it has data that i want to pass through variable... here is my code:

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();
},

.... 我增加了文件名和uriString中..但我想动态添加该值的变量..我怎么能做到这一点????? 科尔多瓦插件的链接 请,如果你知道这不是回答什么...

.... I have added fileName and uristring.. but i want to add that value dynamically from variable.. how can i do this????? cordova plugin link please if you know anything about this than reply...

推荐答案

随着从您提供的链接的例子中,删除的文件名 uriString中的距离应用的对象,和参数所需要的功能。例如,startDownload将变为:

Following the example from the link you provided, remove the fileName and uriString fields from the app object, and parameterize the needed functions. For example, startDownload will become:

startDownload: function (fileName, uriString) {

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

这篇关于javascript文件科尔多瓦..如何通过变量传递价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆