Parcourir la source

pdfng: add comment about getDestinations vs getDestination

Brian Gough il y a 11 ans
Parent
commit
d832406923

+ 6 - 4
services/web/public/coffee/ide/pdfng/directives/pdfRenderer.coffee

@@ -54,17 +54,19 @@ define [
 				@document.then (pdfDocument) ->
 					pdfDocument.getDestinations()
 
-# Not available in pdf.js-1.0.712, in later versions there is a direct
-# call for this - we should use it as soon as it is available in a
-# stable version
 			getDestination: (dest) ->
+				# There is a direct method for this in pdf.js but it is not
+				# available in pdf.js-1.0.712. Use the following workaround of
+				# getting all the destinations and returning only the one we
+				# want.
 				@destinations = @document.then (pdfDocument) ->
 					pdfDocument.getDestinations()
 				return @destinations.then (all) ->
 					all[dest]
 				, (error) ->
 					console.log 'ERROR', error
-
+				# When we upgrade we can switch to using the following direct
+				# code.
 				# @document.then (pdfDocument) ->
 				# 	pdfDocument.getDestination(dest)
 				# , (error) ->