new VMKeyboardService()

Description

Integrates external:VMShortcuts with Shortcuts.

Instances of classes that have Shortcut properties on them can be added and removed to each instance of this service. The shortcuts will be enabled/disabled as the service is activated/deactivated. This can allow each service to have different groups of shortcuts present.

All Shortcuts tie into external:VMShortcuts's conditions. These conditions are added once during instantiation and default to '!inputFocus'.

The built in handler for browser focus events to update 'inputFocus' can be enabled by executing:

Examples
VMKeyboardService.start();

Members


logger :NexusHoratio.base.Logger


name :string

Details
string

shortName :string


<static> services :Set.<module:linkedin-tool~VMKeyboardService>


active :boolean

Details
boolean

shortcuts :Array.<module:linkedin-tool~Shortcut>


<private> shortcutOptions :VM.shortcut.IShortcutOptions

Description

Initial options for all shortcuts.

Details
VM.shortcut.IShortcutOptions

Methods


activate()


deactivate()


on( eventType, func ) → {NexusHoratio.base.Service}

Description

Attach a function to an eventType.

Parameters
Name Type Description
eventType NexusHoratio.base.Dispatcher~EventType

Event type to connect with.

func NexusHoratio.base.Dispatcher~Handler

Single argument function to call.

Returns

This instance, for chaining.


<static> start()

Description

Add listener.


<static> stop()

Description

Remove listener.


off( eventType, func ) → {NexusHoratio.base.Service}

Description

Remove all instances of a function registered to an eventType.

Parameters
Name Type Description
eventType NexusHoratio.base.Dispatcher~EventType

Event type to disconnect from.

func NexusHoratio.base.Dispatcher~Handler

Function to remove.

Returns

This instance, for chaining.


allowReactivation( allow ) → {NexusHoratio.base.Service}

Parameters
Name Type Description
allow boolean

Whether to allow this service to be activated when already active.

Returns

This instance, for chaining.


<static> setKeyboardContext( context, state )

Description

Set the keyboard context to a specific value.

Parameters
Name Type Description
context string

The name of the context.

state object

What the value should be.


setShortName( shortName ) → {NexusHoratio.base.Service}

Parameters
Name Type Description
shortName string

Custom name portion of this instance.

Returns

This instance, for chaining.


<static> parseSeq( seq ) → {string}

Description

Parse a Shortcut#seq and wrap it in HTML.

Parameters
Name Type Description
seq module:linkedin-tool~Shortcut#seq

Keystroke sequence.

Returns

Appropriately wrapped HTML.

Examples
'a c-b' ->
			  '<kbd><kbd>a</kbd> then <kbd>Ctrl</kbd> + <kbd>b</kbd></kbd>'

addInstance( instance ) → {module:linkedin-tool~VMKeyboardService}

Parameters
Name Type Description
instance object

Object with Shortcut properties.

Returns

This instance, for chaining.


removeInstance( instance ) → {module:linkedin-tool~VMKeyboardService}

Parameters
Name Type Description
instance object

Object with Shortcut properties.

Returns

This instance, for chaining.


<private> listenForFocus( element )

Parameters
Name Type Description
element external:Element

Element that gets a listener.


<private> onFocus( evt )

Description

Handle focus event to determine if shortcuts should be disabled.

Parameters
Name Type Description
evt Event

Standard 'focus' event.

Events


activate


activated


deactivate


deactivated