Commit 799850cb authored by csillag's avatar csillag

Code comments

parent bb11fd65
...@@ -231,6 +231,7 @@ describe 'Annotator.Plugin.EnhancedAnchoring', -> ...@@ -231,6 +231,7 @@ describe 'Annotator.Plugin.EnhancedAnchoring', ->
@_rendered = [] @_rendered = []
# Helper function to trigger a page rendering # Helper function to trigger a page rendering
# This is an asynchronous method; returns a promise.
renderPage = (doc, index) -> renderPage = (doc, index) ->
if doc.isPageMapped(index) if doc.isPageMapped(index)
throw new Error "Cannot call renderPage with an already mapped index: #{index}, ensure the document is setup correctly" throw new Error "Cannot call renderPage with an already mapped index: #{index}, ensure the document is setup correctly"
...@@ -248,11 +249,13 @@ describe 'Annotator.Plugin.EnhancedAnchoring', -> ...@@ -248,11 +249,13 @@ describe 'Annotator.Plugin.EnhancedAnchoring', ->
# Resolve the promise # Resolve the promise
resolve() resolve()
# Helper function to trigger a page rendering # Helper function to trigger the rendering of several pages.
# This is an asynchronous method; returns a promise.
renderPages = (doc, indexes) -> renderPages = (doc, indexes) ->
Promise.all(renderPage(doc, index) for index in indexes) Promise.all(renderPage(doc, index) for index in indexes)
# Helper function to trigger a page unrendering # Helper function to trigger a page unrendering
# This is an asynchronous method; returns a promise.
unrenderPage = (doc, index) -> unrenderPage = (doc, index) ->
unless doc.isPageMapped index unless doc.isPageMapped index
throw new Error "Cannot call unrenderPage with an unmapped index: #{index}, ensure the document is setup correctly" throw new Error "Cannot call unrenderPage with an unmapped index: #{index}, ensure the document is setup correctly"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment