-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
Milestone
Description
these are pretty tough but here is a simple example of a type:
/**
* A number, or a string containing a number.
* @typedef {(number|string)} NumberLike
*/
Here's a radical example (real-use):
/**
* Called to get the full path of the view
* @callback getFullPathCallBack
* @return {!string} fullPath of the view
*/
/**
* Called to get the File object of the view
* @callback getFileCallBack
* @return {!File} File object that belongs to the view
*/
/**
* Called to change the show or hide the view
* @callback setVisibleCallBack
* @param {!boolean} true to show the view, false to hide it
*/
/**
* Called to let the view know that it needs to be resized and redrawn
* @callback resizeToFitCallBack
* @param {Object=} hint - hint data on how to redraw the view (can be null)
*/
/**
* Called to destroy the view object so that it can remove its DOM node from the pane
* @callback destroyCallBack
*/
/**
* Called to determine if the view or child of the view has focus
* @callback hasFocusCallBack
* @return {!boolean} true if has focus, false otherwise
*/
/**
* Called to inform the view to give focus to its DOM element
* @callback focusCallBack
*/
/**
* Called to get the view's scroll state so that it can be cached and restored later
* view providers can return any data necessary to restore the scroll position from the cached data
* @callback getScrollPosCallback
* @return {*}
*/
/**
* Called to restore the scrollPane state and adjust it with a given height delta
* @callback adjustScrollPosCallBack
* @param {*} scrollPos - the data cached when getScrollPos was called
* @param {!number} heightDelta - the height to add to the scroll pos data
*/
/**
* Called when a view is moved from one pane to another
* @callback switchContainersCallBack
* @param {jQuery} $container - the new container for the view to move its DOM element in to
*/
/**
* Called to get the owning container of a view
* @callback getContainerCallBack
* @return {jQuery} the container for the view
*/
/**
* View interface
* @typedef {Object} View
* @property {getFullPathCallBack} getFullPath
* @property {getFileCallBack} getFile
* @property {setVisibleCallBack} setVisible
* @property {resizeToFitCallBack} resizeToFit
* @property {destroyCallBack} destroy
* @property {hasFocusCallBack} hasFocus
* @property {hasFocusCallBack} childHasFocus
* @property {focusCallBack} focus
* @property {getScrollPosCallback} getScrollPos
* @property {adjustScrollPosCallBack} adjustScrollPos
* @property {switchContainersCallBack} switchContainers
* @property {getContainerCallBack} getContainer
*/