forked from markeeftb/FileOpener
-
Notifications
You must be signed in to change notification settings - Fork 1
/
fileopener.js
37 lines (33 loc) · 837 Bytes
/
fileopener.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
*
* Copyright (c) 2005-2010, Nitobi Software Inc.
* Copyright (c) 2011, IBM Corporation
*/
/**
* Constructor
*/
function FileOpener() {
};
FileOpener.prototype.open = function(url, failureCB) {
var success = function() {
console.log("success!");
}
var failure = function(error) {
console.log(error);
if(typeof failureCB === "function") {
failureCB(error);
}
}
cordova.exec(success, failure, "FileOpener", "openFile", [url]);
};
/**
* Load Plugin
*/
if(!window.plugins) {
window.plugins = {};
}
if (!window.plugins.fileOpener) {
window.plugins.fileOpener = new FileOpener();
}