-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathCDVPDFViewer.js
71 lines (53 loc) · 1.61 KB
/
CDVPDFViewer.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//PDFViewer based on ChildBrowser
/* MIT licensed */
// (c) 2010 Jesse MacFadyen, Nitobi
//
// CDVPDFViewer
// CDVEmailComposer Template Created Jan 7 2013
// Copyright 2013 @RandyMcMillan
(function() {
var cordovaRef = window.PhoneGap || window.Cordova || window.cordova; // old to new fallbacks
function CDVPDFViewer() {
// Does nothing
}
// Callback when the user chooses the 'Done' button
// called from native
CDVPDFViewer._onClose = function()
{
window.plugins.CDVPDFViewer.onClose();
};
/* The interface that you will use to access functionality */
// Show a webpage, will result in a callback to onLocationChange
CDVPDFViewer.prototype.showPDF = function(loc)
{
cordovaRef.exec("CDVPDFViewer.showPDF", loc);
};
// close the browser, will NOT result in close callback
CDVPDFViewer.prototype.close = function()
{
cordovaRef.exec("CDVPDFViewer.close");
};
// Not Implemented
CDVPDFViewer.prototype.jsExec = function(jsString)
{
// Not Implemented!!
//PhoneGap.exec("PDFViewerCommand.jsExec",jsString);
};
// Note: this plugin does NOT install itself, call this method some time after deviceready to install it
// it will be returned, and also available globally from window.plugins.PDFViewer
CDVPDFViewer.install = function()
{
if(!window.plugins) {
window.plugins = {};
}
if ( ! window.plugins.CDVPDFViewer ) {
window.plugins.CDVPDFViewer = new CDVPDFViewer();
}
};
if (cordovaRef && cordovaRef.addConstructor) {
cordovaRef.addConstructor(CDVPDFViewer.install);
} else {
console.log("CDVPDFViewer Cordova Plugin could not be installed.");
return null;
}
})();