Skip to content

Commit

Permalink
Chore: Updating method decorators (#311)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Press committed Aug 24, 2017
1 parent 987a417 commit 9ae3853
Show file tree
Hide file tree
Showing 14 changed files with 119 additions and 8 deletions.
6 changes: 6 additions & 0 deletions src/lib/Browser.js
Expand Up @@ -278,6 +278,7 @@ class Browser {
/**
* Returns whether the browser is a mobile browser.
*
* @public
* @return {boolean} true if browser supports download
*/
static isMobile() {
Expand All @@ -289,6 +290,8 @@ class Browser {
* Returns whether the browser can download via HTML5. taken from Modernizr:
* https://github.com/Modernizr/Modernizr/blob/master/feature-detects/a/download.js
* Currently not supported by IE11 or Safari 10.0 http://caniuse.com/#feat=download
*
* @public
* @return {boolean} true if browser supports download
*/
static canDownload() {
Expand All @@ -298,6 +301,7 @@ class Browser {
/**
* Returns whether or not the device is running IOS
*
* @public
* @return {boolean} true if the device is running IOS
*/
static isIOS() {
Expand All @@ -307,6 +311,7 @@ class Browser {
/**
* Returns whether or not the device is running Android
*
* @public
* @return {boolean} true if the device is running Android
*/
static isAndroid() {
Expand All @@ -316,6 +321,7 @@ class Browser {
/**
* Returns whether or not the device is running IOS 10.3.x that has Font Ligature rendering issue.
*
* @public
* @return {boolean} Whether device is running 10.3.x
*/
static isIOSWithFontIssue() {
Expand Down
12 changes: 9 additions & 3 deletions src/lib/Cache.js
Expand Up @@ -16,6 +16,7 @@ class Cache {
* Caches a simple object in memory and in localStorage if specified.
* Note that objects cached in localStorage will be stringified.
*
* @public
* @param {string} key - The cache key
* @param {*} value - The cache value
* @param {boolean} useLocalStorage - Whether or not to use localStorage
Expand All @@ -32,6 +33,7 @@ class Cache {
/**
* Deletes object from in-memory cache and localStorage.
*
* @public
* @param {string} key - The cache key
* @return {void}
*/
Expand All @@ -46,6 +48,7 @@ class Cache {
/**
* Checks if cache has provided key.
*
* @public
* @param {string} key - The cache key
* @return {boolean} Whether the cache has key
*/
Expand All @@ -58,8 +61,9 @@ class Cache {
* tries to fetch from localStorage. If fetched from localStorage, object
* will be a JSON parsed object.
*
* @public
* @param {string} key - Key of cached object
* @return {*} Cached object
* @return {Object} Cached object
*/
get(key) {
if (this.inCache(key)) {
Expand Down Expand Up @@ -87,6 +91,7 @@ class Cache {
/**
* Checks if memory cache has provided key.
*
* @private
* @param {string} key - The cache key
* @return {boolean} Whether the cache has key
*/
Expand All @@ -97,6 +102,7 @@ class Cache {
/**
* Checks if memory cache has provided key.
*
* @private
* @param {string} key - The cache key
* @return {boolean} Whether the cache has key
*/
Expand All @@ -117,8 +123,8 @@ class Cache {
* localStorage was available the first time this is called, but becomes
* unavailable at a later time.
*
* @return {boolean} Whether or not localStorage is available or not.
* @private
* @return {boolean} Whether or not localStorage is available or not.
*/
localStorageAvailable() {
if (this.available === undefined) {
Expand All @@ -139,9 +145,9 @@ class Cache {
* Generates a key to use for localStorage from the provided key. This
* should prevent name collisions.
*
* @private
* @param {string} key - Generate key from this key
* @return {string} Generated key for localStorage
* @private
*/
generateKey(key) {
return `bp-${key}`;
Expand Down
8 changes: 7 additions & 1 deletion src/lib/Controls.js
Expand Up @@ -142,6 +142,7 @@ class Controls {
/**
* Handles all focusin events for the module.
*
* @private
* @param {Event} event - A DOM-normalized event object.
* @return {void}
*/
Expand All @@ -156,6 +157,7 @@ class Controls {
/**
* Handles all focusout events for the module.
*
* @private
* @param {Event} event - A DOM-normalized event object.
* @return {void}
*/
Expand All @@ -169,6 +171,7 @@ class Controls {
/**
* Handles click events for the control bar.
*
* @private
* @param {Event} event - A DOM-normalized event object.
* @return {void}
*/
Expand All @@ -180,7 +183,7 @@ class Controls {
/**
* Adds buttons to controls
*
* @private
* @public
* @param {string} text - button text
* @param {Function} handler - button handler
* @param {string} [classList] - optional class list
Expand Down Expand Up @@ -216,6 +219,7 @@ class Controls {
/**
* Enables the controls.
*
* @public
* @return {void}
*/
enable() {
Expand All @@ -225,6 +229,7 @@ class Controls {
/**
* Disables the controls.
*
* @public
* @return {void}
*/
disable() {
Expand All @@ -234,6 +239,7 @@ class Controls {
/**
* Determines if the page number input is focused.
*
* @public
* @return {boolean} Is the input focused
*/
isPageNumFocused() {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Fullscreen.js
Expand Up @@ -81,7 +81,7 @@ class Fullscreen extends EventEmitter {
/**
* Toggles fullscreen mode
*
* @private
* @public
* @param {HTMLElement} el - fullscreen element
* @return {void}
*/
Expand Down
8 changes: 8 additions & 0 deletions src/lib/Logger.js
Expand Up @@ -38,6 +38,7 @@ class Logger {
/**
* Gets browser capability information.
*
* @private
* @return {Object} Browser capability information
*/
getBrowserInfo() {
Expand All @@ -61,6 +62,7 @@ class Logger {
/**
* Marks file as cached.
*
* @public
* @return {void}
*/
setCached() {
Expand All @@ -70,6 +72,7 @@ class Logger {
/**
* Marks file as stale cache.
*
* @public
* @return {void}
*/
setCacheStale() {
Expand All @@ -79,6 +82,7 @@ class Logger {
/**
* Marks file as converted.
*
* @public
* @return {void}
*/
setUnConverted() {
Expand All @@ -89,6 +93,7 @@ class Logger {
/**
* Marks file as preloaded.
*
* @public
* @return {void}
*/
setPreloaded() {
Expand All @@ -98,6 +103,7 @@ class Logger {
/**
* Sets the file object.
*
* @public
* @param {Object} file - file object
* @return {void}
*/
Expand All @@ -108,6 +114,7 @@ class Logger {
/**
* Sets the file type.
*
* @public
* @param {string} type - content type
* @return {void}
*/
Expand All @@ -118,6 +125,7 @@ class Logger {
/**
* Finishes logging.
*
* @public
* @param {Object} count - Preview count
* @return {Object} Metrics object
*/
Expand Down
3 changes: 3 additions & 0 deletions src/lib/Notification.js
Expand Up @@ -39,6 +39,7 @@ class Notification {
/**
* Shows a notification message.
*
* @public
* @param {string} message - Notification message
* @param {string} [buttonText] - Optional text to show in button
* @return {void}
Expand All @@ -62,6 +63,7 @@ class Notification {
/**
* Hides the notification message. Does nothing if the notification is already hidden.
*
* @public
* @return {void}
*/
hide() {
Expand All @@ -77,6 +79,7 @@ class Notification {
/**
* Click handler for notification.
*
* @private
* @param {Event} event - DOM event
* @return {void}
*/
Expand Down
9 changes: 9 additions & 0 deletions src/lib/Popup.js
Expand Up @@ -74,6 +74,7 @@ class Popup {
/**
* Shows a popup with a message.
*
* @public
* @param {string} message - Popup message
* @param {string} [buttonText] - Optional text to show in button
* @param {Function} [buttonHandler] - Optional onclick function for the button
Expand All @@ -99,6 +100,7 @@ class Popup {
/**
* Hides the popup message.
*
* @public
* @return {void}
*/
hide() {
Expand All @@ -108,6 +110,7 @@ class Popup {
/**
* Adds custom content to the modal.
*
* @public
* @param {string} element - DOM element
* @param {boolean} prepend - prepends or appends the content to the content element
*
Expand All @@ -125,6 +128,7 @@ class Popup {
/**
* Returns whether or not the popup is visible.
*
* @public
* @return {boolean} Whether or not popup is visible.
*/
isVisible() {
Expand All @@ -134,6 +138,7 @@ class Popup {
/**
* Gets whether or not the button is disabled.
*
* @public
* @return {boolean} Whether or not button is diabled
*/
isButtonDisabled() {
Expand All @@ -143,6 +148,7 @@ class Popup {
/**
* Disbles the button element.
*
* @public
* @return {void}
*/
disableButton() {
Expand All @@ -153,6 +159,7 @@ class Popup {
/**
* Enables the button element.
*
* @public
* @return {void}
*/
enableButton() {
Expand All @@ -163,6 +170,7 @@ class Popup {
/**
* Click handler for popup.
*
* @private
* @param {Event} event - DOM event
* @return {void}
*/
Expand All @@ -184,6 +192,7 @@ class Popup {
/**
* Keydown handler for popup
*
* @private
* @param {Event} event - Keydown event
* @return {boolean} Consumed or not
*/
Expand Down

0 comments on commit 9ae3853

Please sign in to comment.