This package has been deprecated

Author message:

This package has been deprecated. Please use the '@atlaskit' scoped packages instead. See https://atlaskit.atlassian.com for more information

akutil-common

5.0.1 • Public • Published

AtlasKit component registry Commitizen friendly semantic-release Report an issue Ask in our forum

AtlasKit common utilities

A set of common utilities for all AtlasKit components

Classes

KeyPressHandler

A general class to deal with key activations

Functions

computeBooleanValue()

Like el.hasAttribute(attr) but designed for use within a skate attribute change handler where you only have access to change.oldValue.

enumeration()

This property extension can be used with skate. Usage:

  props: {
      respondsTo: props.enum({values: ['toggle', 'hover'],
      missingDefault: 'toggle',
      invalidDefault: 'toggle'})({
  })

}

KeyPressHandler

A general class to deal with key activations

Kind: global class

new KeyPressHandler(key, callback, [elem])

Adds a new keypress handler

Param Type Description
key String A named key. Case insensitive.
callback function A callback function to invoke if the given key was activated. The callback is passed the event object.
[elem] Node The element to listen for the key activation. Defaults to document if none given.

keyPressHandler.add(key, callback)

Adds or replaces a key that is listened for.

Kind: instance method of KeyPressHandler

Param Type Description
key String A named key. Case insensitive. Replaces any previous listened key.
callback function The callback function to invoke.

keyPressHandler.destroy([key])

Removes a key from the list of listened keys. Or removes the whole listener if no key given.

Kind: instance method of KeyPressHandler

Param Type Description
[key] String A named key. Case insensitive. If none given, event listener is removed.

computeBooleanValue()

Like el.hasAttribute(attr) but designed for use within a skate attribute change handler where you only have access to change.oldValue.

Kind: global function

enumeration()

This property extension can be used with skate. Usage:

props: {
    respondsTo: props.enum({values: ['toggle', 'hover'],
    missingDefault: 'toggle',
    invalidDefault: 'toggle'})({

    })
}

Kind: global function

Support and feedback

We're here to help!

Let us know what you think of our components and docs, your feedback is really important for us.

Community support

Ask a question in our forum.

Check if someone has already asked the same question before.

Create a support ticket

Are you in trouble? Let us know!

Readme

Keywords

Package Sidebar

Install

npm i akutil-common

Weekly Downloads

825

Version

5.0.1

License

Apache-2.0

Last publish

Collaborators

  • atlassian-aui