the23thwarrior
the23thwarrior

Reputation: 91

Cordova + RequireJS: How load the File-Plugin

I want to store Files (Images) in my Cordova (3.6.4) App which is build with RequireJS.

I made a new Module but i don't know how to load the File-Plugin (org.apache.cordova.file) with RequireJS. window.requestFileSystem is always undefined. I thought i have to load the FileSystem (as commented in the module) but nothing worked...

define(function (require) {

"use strict";

var $ = require('jquery'),
    //FileSystem = require('/plugins/org.apache.cordova.file/www/FileSystem'),


download = function (URL, Folder_Name, File_Name) {
    //step to request a file system 
    window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, fileSystemSuccess, fileSystemFail);
},

return {
    download: download
};
});

Upvotes: 3

Views: 1213

Answers (1)

the23thwarrior
the23thwarrior

Reputation: 91

I found it. It was an easy (and a little embarrassing) one. I simply forgot to load the cordova script itself because i didn't needed it to this point...

My app starts now with the following and everything is works.

require(['../cordova', '../cordova_plugins'], function () {

Upvotes: 1

Related Questions