Skip to content

Commit

Permalink
Refactored unneccessary func statements
Browse files Browse the repository at this point in the history
  • Loading branch information
pipwerks committed Apr 12, 2016
1 parent 0634428 commit cc3f6b5
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions pdfobject.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
PDFObject v2.0.20160411
PDFObject v2.0.20160411.1
https://github.com/pipwerks/PDFObject
Copyright (c) 2008-2016 Philip Hutchison
MIT-style license: http://pipwerks.mit-license.org/
Expand All @@ -18,9 +18,8 @@ var PDFObject = (function (){
//declare functions
createAXO,
isIE,
supportsPdfMimeType,
supportsPdfMimeType = (typeof navigator.mimeTypes['application/pdf'] !== "undefined"),
supportsPdfActiveX,
isPdfSupported,
buildQueryString,
log,
embedError,
Expand Down Expand Up @@ -50,17 +49,15 @@ var PDFObject = (function (){
//window.ActiveXObject will evaluate to false in IE 11, but "ActiveXObject" in window evaluates to true
//so check the first one for older IE, and the second for IE11
//FWIW, MS Edge (replacing IE11) does not support ActiveX at all, both will evaluate false
isIE = function (){ return !!(window.ActiveXObject) || !!("ActiveXObject" in window); };

//Invoke immediately, this value will be required below.
//If kept as function call, it would be re-evaluated over and over.
supportsPdfMimeType = function () { return (typeof navigator.mimeTypes['application/pdf'] !== "undefined"); };
//Constructed as a method (not a prop) to avoid unneccesarry overhead -- will only be evaluated if needed
isIE = function (){ return !!(window.ActiveXObject || "ActiveXObject" in window); };

//If either ActiveX support for "AcroPDF.PDF" or "PDF.PdfCtrl" are found, return true
//Constructed as a method (not a prop) to avoid unneccesarry overhead -- will only be evaluated if needed
supportsPdfActiveX = function (){ return !!(createAXO("AcroPDF.PDF") || createAXO("PDF.PdfCtrl")); };

//Determines whether PDF support is available
isPdfSupported = function (){ return supportsPdfMimeType() || (isIE() && supportsPdfActiveX()); };
supportsPDFs = (supportsPdfMimeType || (isIE() && supportsPdfActiveX()));

//Creating a querystring for using PDF Open parameters when embedding PDF
buildQueryString = function(pdfParams){
Expand Down Expand Up @@ -228,8 +225,6 @@ var PDFObject = (function (){

};

supportsPDFs = isPdfSupported();

return {
embed: function (a,b,c){ return embed(a,b,c); },
pdfobjectversion: (function () { return pdfobjectversion; })(),
Expand Down

0 comments on commit cc3f6b5

Please sign in to comment.