(関数(ウィンドウ){
/ **
ファイルのダウンロード
@method app.download
@静的
@paramオプション{オブジェクト}
@paramのoption.url {文字列}ダウンロードアドレス
* /
app.download =機能(オプション){
もし(オプション&&!option.attachmentUrl){
リターン;
}
VAR docuementName = option.attachmentName。
VAR filePathに= window.savePath + "/" + docuementName。
console.log( 'ファイルパスからダウンロード'、filePathに)
VAR URL = option.attachmentUrl。
VARファイル転送=新しい変数をFileTransfer();
fileTransfer.download(
URL、
ファイルパス、
関数(エントリ){
//保存ファイルのパスは一緒に、簡単にコールバックします
window.fileUri = entry.fullPath.replace( "ファイル:///"、 "ファイル://");
VAR URL = window.fileUri。
app.openFile(URL、 ""、機能(RES){
app.hint( "オープン成功!");
});
}、
関数(誤差){
console.log(「オープン失敗「)
app.hint( "ダウンロードに失敗しました!");
}
);
}。
})(窓);