[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/js/dist/ -> keyboard-shortcuts.js (summary)

External dependencies

File Size: 791 lines (23 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 24 functions

  reducer()
  registerShortcut()
  unregisterShortcut()
  arrayOf()
  isObjectLike()
  createCache()
  isShallowEqual()
  rememo()
  getRootCache()
  getWeakMapCache()
  clear()
  callSelector()
  getKeyCombinationRepresentation()
  getShortcutKeyCombination()
  getShortcutRepresentation()
  getShortcutDescription()
  getShortcutAliases()
  useShortcutEventMatch()
  isMatch()
  useShortcut()
  _callback()
  _extends()
  ShortcutProvider()
  onKeyDown()

Functions
Functions that are not part of a class:

reducer()   X-Ref
Reducer returning the registered shortcuts

return: {Object} Updated state.
param: {Object} state  Current state.
param: {Object} action Dispatched action.

registerShortcut(_ref)   X-Ref
Returns an action object used to register a new keyboard shortcut.

return: {Object} action.
param: {WPShortcutConfig} config Shortcut config.

unregisterShortcut(name)   X-Ref
Returns an action object used to unregister a keyboard shortcut.

return: {Object} action.
param: {string} name Shortcut name.

arrayOf( value )   X-Ref
Returns the first argument as the sole entry in an array.

return: {Array} Value returned as entry in array.
param: {*} value Value to return.

isObjectLike( value )   X-Ref
Returns true if the value passed is object-like, or false otherwise. A value
is object-like if it can support property assignment, e.g. object or array.

return: {boolean} Whether value is object-like.
param: {*} value Value to test.

createCache()   X-Ref
Creates and returns a new cache object.

return: {Object} Cache object.

isShallowEqual( a, b, fromIndex )   X-Ref
Returns true if entries within the two arrays are strictly equal by
reference from a starting index.

return: {boolean} Whether arrays are shallowly equal.
param: {Array}  a         First array.
param: {Array}  b         Second array.
param: {number} fromIndex Index from which to start comparison.

rememo(selector, getDependants )   X-Ref
Returns a memoized selector function. The getDependants function argument is
called before the memoized selector and is expected to return an immutable
reference or array of references on which the selector depends for computing
its own return value. The memoize cache is preserved only as long as those
dependant references remain the same. If getDependants returns a different
reference(s), the cache is cleared and the selector value regenerated.

return: {Function} Memoized selector.
param: {Function} selector      Selector function.
param: {Function} getDependants Dependant getter returning an immutable

getRootCache()   X-Ref
Returns the root cache. If WeakMap is supported, this is assigned to the
root WeakMap cache set, otherwise it is a shared instance of the default
cache object.

return: {(WeakMap|Object)} Root cache object.

getWeakMapCache( dependants )   X-Ref
Returns the cache for a given dependants array. When possible, a WeakMap
will be used to create a unique cache for each set of dependants. This
is feasible due to the nature of WeakMap in allowing garbage collection
to occur on entries where the key object is no longer referenced. Since
WeakMap requires the key to be an object, this is only possible when the
dependant is object-like. The root cache is created as a hierarchy where
each top-level key is the first entry in a dependants set, the value a
WeakMap where each key is the next dependant, and so on. This continues
so long as the dependants are object-like. If no dependants are object-
like, then the cache is shared across all invocations.

return: {Object} Cache object.
param: {Array} dependants Selector dependants.

clear()   X-Ref
Resets root memoization cache.


callSelector( )   X-Ref
The augmented selector call, considering first whether dependants have
changed before passing it to underlying memoize function.

return: {*} Selector result.
param: {Object} source    Source object for derivation.
param: {...*}   extraArgs Additional arguments to pass to selector.

getKeyCombinationRepresentation(shortcut, representation)   X-Ref
Returns a string representing the key combination.

return: {string?} Shortcut representation.
param: {?WPShortcutKeyCombination} shortcut       Key combination.
param: {keyof FORMATTING_METHODS}  representation Type of representation

getShortcutKeyCombination(state, name)   X-Ref
Returns the main key combination for a given shortcut name.

return: {WPShortcutKeyCombination?} Key combination.
param: {Object} state Global state.
param: {string} name  Shortcut name.

getShortcutRepresentation(state, name)   X-Ref
Returns a string representing the main key combination for a given shortcut name.

return: {string?} Shortcut representation.
param: {Object}                   state          Global state.
param: {string}                   name           Shortcut name.
param: {keyof FORMATTING_METHODS} representation Type of representation

getShortcutDescription(state, name)   X-Ref
Returns the shortcut description given its name.

return: {string?} Shortcut description.
param: {Object} state Global state.
param: {string} name  Shortcut name.

getShortcutAliases(state, name)   X-Ref
Returns the aliases for a given shortcut name.

return: {WPShortcutKeyCombination[]} Key combinations.
param: {Object} state Global state.
param: {string} name  Shortcut name.

useShortcutEventMatch()   X-Ref
Returns a function to check if a keyboard event matches a shortcut name.

return: {Function} A function to to check if a keyboard event matches a

isMatch(name, event)   X-Ref
A function to check if a keyboard event matches a predefined shortcut
combination.

return: {boolean} True if the event matches any shortcuts, false if not.
param: {string}        name  Shortcut name.
param: {KeyboardEvent} event Event to check.

useShortcut(name, callback)   X-Ref
Attach a keyboard shortcut handler.

param: {string}   name               Shortcut name.
param: {Function} callback           Shortcut callback.
param: {Object}   options            Shortcut options.
param: {boolean}  options.isDisabled Whether to disable to shortut.

_callback(event)   X-Ref
No description

_extends()   X-Ref
No description

ShortcutProvider(props)   X-Ref
Handles callbacks added to context by `useShortcut`.

return: {import('@wordpress/element').WPElement} Component.
param: {Object} props Props to pass to `div`.

onKeyDown(event)   X-Ref
No description



Generated: Thu Nov 21 01:00:03 2024 Cross-referenced by PHPXref 0.7.1