Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cordova-plugin-document-viewer

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordova-plugin-document-viewer - npm Package Compare versions

Comparing version 0.6.0 to 0.7.0

2

bower.json
{
"name": "cordova-plugin-document-viewer",
"version": "0.6.0",
"version": "0.7.0",
"dependencies": {

@@ -5,0 +5,0 @@ "winjs": "latest",

{
"name": "cordova-plugin-document-viewer",
"version": "0.6.0",
"version": "0.7.0",
"description": "Document viewer cordova plugin for iOS, Android and Windows 8.1 + 10.",

@@ -32,3 +32,3 @@ "license": "MIT",

"cordovaDependencies": {
"0.6.0": {
"0.7.0": {
"cordova": ">=3.7.0",

@@ -35,0 +35,0 @@ "cordova-windows": ">=4.4.0"

@@ -53,2 +53,4 @@ Cordova Document Viewer Plugin

The plugin is published at the [npm plugin registry][CDV_plugin].
### Local development environment

@@ -116,3 +118,3 @@ From master:

```js
options: {
var options = {
title: STRING,

@@ -139,9 +141,9 @@ documentView : {

enabled : BOOLEAN
},
}
}
```
### Check if a Document File could be shown###
### Check if a Document File could be shown ###
```js
SitewaertsDocumentViewer.canViewDocument(
cordova.plugins.SitewaertsDocumentViewer.canViewDocument(
url, contentType, options, onPossible, onMissingApp, onImpossible, onError);

@@ -152,3 +154,3 @@ ```

```js
function(){
function onPossible(){
window.console.log('document can be shown');

@@ -161,3 +163,3 @@ //e.g. track document usage

```js
function(appId, installer)
function onMissingApp(appId, installer)
{

@@ -174,3 +176,3 @@ if(confirm("Do you want to install the free PDF Viewer App "

```js
function(){
function onImpossible(){
window.console.log('document cannot be shown');

@@ -183,3 +185,3 @@ //e.g. track document usage

```js
function(error){
function onError(error){
window.console.log(error);

@@ -193,3 +195,3 @@ alert("Sorry! Cannot show document.");

```js
SitewaertsDocumentViewer.viewDocument(
cordova.plugins.SitewaertsDocumentViewer.viewDocument(
url, mimeType, options, onShow, onClose, onMissingApp, onError);

@@ -200,3 +202,3 @@ ```

```js
function(){
function onShow(){
window.console.log('document shown');

@@ -208,3 +210,3 @@ //e.g. track document usage

```js
function(){
function onClose(){
window.console.log('document closed');

@@ -216,3 +218,3 @@ //e.g. remove temp files

```js
function(id, installer)
function onMissingApp(id, installer)
{

@@ -228,3 +230,3 @@ if(confirm("Do you want to install the free PDF Viewer App "

```js
function(error){
function onError(error){
window.console.log(error);

@@ -306,1 +308,2 @@ alert("Sorry! Cannot view document.");

[winjs]: http://try.buildwinjs.com/

@@ -134,3 +134,3 @@ // cordova-plugin-document-viewer

{
window.console.log(errorPrefix, err);
window.console.log(errorPrefix, err);
if (onError)

@@ -218,4 +218,49 @@ {

{
var me = this;
var errorPrefix = "Error in " + JS_HANDLE + ".viewDocument(): ";
var _hideStatusBarOnClose = false;
function _beforeShow(next)
{
if (window.StatusBar && window.device
&& window.device.platform.toLowerCase() == 'ios')
{
if (!window.StatusBar.isVisible)
{
// show statusbar to avoid black bar on top of native document viewer screen
// should better be fixed in native ios code
window.StatusBar.show();
_hideStatusBarOnClose = true;
}
}
if(next)
next();
}
function _beforeClose(next)
{
if (_hideStatusBarOnClose)
{
_hideStatusBarOnClose = false;
window.StatusBar.hide();
}
if(next)
next();
}
function _close(){
_beforeClose(onClose);
}
function _onError(e)
{
window.console.log(errorPrefix, e);
_beforeClose(function ()
{
if (onError)
onError(e);
});
}
try

@@ -234,66 +279,66 @@ {

{
exec(
function (result)
{
var status = result ? result.status : null;
_beforeShow(function ()
{
exec(
function (result)
{
var status = result ? result.status : null;
if (status == 1)
{
if (onShow)
onShow();
}
else if (status == 0)
{
if (onClose)
onClose();
}
else
{
var errorMsg =
"unknown state '" + status
+ "'";
window.console.log(
errorPrefix + errorMsg);
}
},
function (err)
{
window.console.log(errorPrefix, err);
if (onError)
onError(err);
},
CDV_HANDLE,
CDV_HANDLE_ACTIONS.VIEW_DOCUMENT,
[
{url: url, contentType: contentType, options: options}
]
);
if (status == 1)
{
if (onShow)
onShow();
}
else if (status == 0)
{
_close();
}
else
{
var errorMsg =
"unknown state '" + status
+ "'";
window.console.log(
errorPrefix + errorMsg);
}
},
_onError,
CDV_HANDLE,
CDV_HANDLE_ACTIONS.VIEW_DOCUMENT,
[
{
url: url,
contentType: contentType,
options: options
}
]
);
});
},
function (appId, installer)
{
if (onMissingApp)
onMissingApp(appId, installer);
else
installer(function ()
{
window.console.log("App successfully installed");
}, onError);
_beforeClose(function ()
{
if (onMissingApp)
onMissingApp(appId, installer);
else
installer(function ()
{
window.console.log(
"App successfully installed");
}, _onError);
});
},
function ()
{
var errorMsg = "invalid file url '" + url + "' or no viewer for mime type '" + contentType + "'";
window.console.log(errorPrefix + errorMsg);
if (onError)
onError(errorMsg);
_onError("invalid file url '" + url
+ "' or no viewer for mime type '" + contentType
+ "'");
},
onError
_onError
);
}
catch (e)
{
window.console.log(errorPrefix, e);
if (onError)
onError(e);
_onError(e);
}

@@ -300,0 +345,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc