Skip to content

Commit

Permalink
Chore: Preview UI as instance (#204)
Browse files Browse the repository at this point in the history
- Required so multiple previews can run on the same page
- Refactor UI code into a class and instantiate as a property of each Preview instance
- Pass PreviewUI to Annotator and viewers
- Refactor cache to be a property of each Preview instance
- Fix tests
- Move ProgressBar into PreviewUI
- Update JSDoc for class public fields
  • Loading branch information
tonyjin authored Jul 7, 2017
1 parent d4303aa commit 5d06fb3
Show file tree
Hide file tree
Showing 41 changed files with 726 additions and 735 deletions.
2 changes: 1 addition & 1 deletion src/lib/Cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,4 @@ class Cache {
}
}

export default new Cache();
export default Cache;
30 changes: 5 additions & 25 deletions src/lib/Controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,19 @@ const CONTROLS_PAGE_NUM_WRAPPER_CLASS = 'bp-doc-page-num-wrapper';
const CONTROLS_AUTO_HIDE_TIMEOUT_IN_MILLIS = 1500;

class Controls {
/**
* Controls container element
*
* @property {HTMLElement}
*/
/** @property {HTMLElement} - Controls container element */
containerEl;

/**
* Controls element
*
* @property {HTMLElement}
*/
/** @property {HTMLElement} - Controls element */
controlsEl;

/**
* Array of buttons for cleanup purposes
*
* @property {Array}
*/
/** @property {Object[]} - Array of button elements and their event listeners, used for cleanup */
buttonRefs = [];

/**
* Indicates if the control bar should be hidden or not
*
* @property {boolean}
*/
/** @property {boolean} - Whether control bar should be hidden */
shouldHide = true;

/**
* Indicates if the browser supports touch events
*
* @property {boolean}
*/
/** @property {boolean} - Whether browser supports touch */
hasTouch = Browser.hasTouch();

/**
Expand Down
Loading

0 comments on commit 5d06fb3

Please sign in to comment.