Extends
Members
container :jQuery
Container element for the ribbon menu.
Type:
- jQuery
lastSelected :string
ID of the last selected ribbon.
Type:
- string
ribbons :Object.<string, Object>
Collection of ribbon configurations.
Type:
- Object.<string, Object>
Methods
add(id, options) → {Object}
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id |
string | The ID of the ribbon. |
|||||||||||||||||||||||||||||||||||
options |
Object | The options for the ribbon. Properties
|
Returns:
The added ribbon configuration.
- Type
- Object
clear()
defaultClickEvt()
init()
isExist(id) → {boolean}
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the ribbon. |
Returns:
True if the ribbon exists, false otherwise.
- Type
- boolean
off(evt, fn)
- Description:
Removes an event
Equal to$(document).off()
- Source:
- Since:
- 4.3.20
- Overrides:
Example
trans.off('transLoaded', (e, opt)=> {
// do something
})
Parameters:
Name | Type | Description |
---|---|---|
evt |
String | Event name |
fn |
function | Function to trigger |
on(evt, fn)
- Description:
Create a new event with JQuery eventing convenience
Equal to$(document).on()
- Source:
- Since:
- 4.3.20 trans.on('transLoaded', (e, opt)=> { // do something })
- Overrides:
Parameters:
Name | Type | Description |
---|---|---|
evt |
String | Event name |
fn |
function | Function to trigger |
onReady(fn)
Parameters:
Name | Type | Description |
---|---|---|
fn |
function | The function to execute. |
one(evt, fn)
- Description:
Run the event once
Trigger an event and immediately removes it
Equal to$(document).one()
- Source:
- Since:
- 4.3.20
- Overrides:
Parameters:
Name | Type | Description |
---|---|---|
evt |
String | Event name |
fn |
function | Function to trigger |
processWith(processName, value) → {*}
- Description:
Add a custom process to a value.
- Source:
- Overrides:
Parameters:
Name | Type | Description |
---|---|---|
processName |
String | Name of the process |
value |
* | Value to be processed |
Returns:
- By default will return value as is
- Type
- *
rejectState(state, erroropt)
- Description:
Reject a state
- Source:
- Overrides:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
state |
String | State name |
|
error |
String |
<optional> |
Error message |
remove(id)
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the ribbon to remove. |
resolveState(state, argopt)
- Description:
Resolve a state
- Source:
- Overrides:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
state |
String | State name |
|
arg |
* |
<optional> |
Arguments to be passed to |
select($ribbon, triggeropt)
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
$ribbon |
jQuery | string | The ribbon element or its ID. |
||
trigger |
boolean |
<optional> |
true
|
Whether to trigger the onClick event. |
trigger(evt, fn)
- Description:
Trigger an event
Equal to$(document).trigger()
- Source:
- Since:
- 4.3.20
- Overrides:
Parameters:
Name | Type | Description |
---|---|---|
evt |
String | Event name |
fn |
function | Function to trigger |
(async) until(state) → {Promise.<*>}
- Description:
State monitor. Wait until a state is resolved.
Will wait until resolveState is called.
Will immidiately executed if resolveState is already called
- Source:
- Since:
- 4.12.4
- Overrides:
Examples
Basic usage
await basicEventHandler.until("ready");
Asynchronous chaining
basicEventHandler.until("ready")
.then((result) = >{
console.log(result);
})
basicEventHandler.resolveState("ready", "Hello world");
// prints: Hello world
Immidiately executed if `resolveState` with the same state has already been called
basicEventHandler.resolveState("ready", "App is ready");
var msg = await basicEventHandler.until("ready");
console.log(msg);
//immidately prints "App is ready"
Parameters:
Name | Type | Description |
---|---|---|
state |
String | State name |
Returns:
- Returns any variables passed on resolveState
- Type
- Promise.<*>
Type Definitions
Event
- Description:
BasicEventHandler's event. This itself extends the standard Event API for html element. So, you can use the default element's event such as click, focus, blur, etc.
Methods that uses Event are:on()
,off()
,one()
,trigger()
- Source:
- Overrides:
- See:
BasicEventHandler's event. This itself extends the standard Event API for html element. So, you can use the default element's event such as click, focus, blur, etc.
Methods that uses Event are: on()
, off()
, one()
, trigger()
Type:
- Event
State
- Description:
Javascript's Promise type event handler.
The state will switch from off to on once. And after that, it will stay in that state forever, so any furtheruntil()
call will be resolved immidiately.
Methods that uses Event are:until()
,resolveState()
,rejectState()
- Source:
- Since:
- 4.12.1
- Overrides:
Javascript's Promise type event handler.
The state will switch from off to on once. And after that, it will stay in that state forever, so any further until()
call will be resolved immidiately.
Methods that uses Event are: until()
, resolveState()
, rejectState()
Type:
- Promise
Events
active
beforeSelect
ready
select
Properties:
Name | Type | Description |
---|---|---|
id |
string | The ID of the selected ribbon. |
Type:
- string