You are reading 12.8.0. See this page in 13.4.1.
Titanium.UI.Shortcut
Extends Titanium.Proxy
Manage application shortcuts.
Allows the creation of application shortcuts, which can be detected using
the click event from Titanium.UI.Shortcut.
On iOS, shortcuts are only supported on a 3D Touch compatible device. Use the Titanium.UI.iOS.forceTouchSupported property to see if it's supported.
Examples
Simple Shortcut Example
Create a shortcut item and detect its click with the click event.
const win = Ti.UI.createWindow({ backgroundColor: 'grey' });
// Listen for shortcut item clicks from the end-user.
Ti.UI.Shortcut.addEventListener('click', e => {
// Event's "item" property indicates which shortcut item was clicked on.
console.log(`id: ${e.item.id}`);
// Set background to 'blue' when a shortcut was clicked on.
win.backgroundColor = 'blue';
});
// Button to add a shortcut item.
const btn = Ti.UI.createButton({ title: 'ADD SHORTCUT' });
btn.addEventListener('click', () => {
const shortcutItem = Ti.UI.createShortcutItem({
id: 'test_shortcut',
title: 'TEST',
description: 'DESCRIPTION'
});
Ti.UI.Shortcut.add(shortcutItem);
});
win.add(btn);
win.open();
Properties 5
Inherited from Titanium.Proxy
The name of the API that this proxy corresponds to.
Inherited from Titanium.Proxy
Indicates if the proxy will bubble an event to its parent.
Default: true
List dynamic shortcuts.
Array of shortcut items that were added to the app via the Titanium.UI.Shortcut.add method.
Inherited from Titanium.Proxy
The Window or TabGroup whose Activity lifecycle should be triggered on the proxy.
List current pinned/static shortcuts.
Methods 8
Adds a shortcut item to the application.
| Parameters | Type | Description |
|---|---|---|
| item | Titanium.UI.ShortcutItem | Titanium.UI.ShortcutItem to add. |
Inherited from Titanium.Proxy
Adds the specified callback as an event listener for the named event.
| Parameters | Type | Description |
|---|---|---|
| name | String | Name of the event. |
| callback | Callback<Titanium.Event> | Callback function to invoke when the event is fired. 4 fields
|
applyProperties
since 3.0.0Inherited from Titanium.Proxy
Applies the properties to the proxy.
| Parameters | Type | Description |
|---|---|---|
| props | Dictionary | A dictionary of properties to apply. |
Inherited from Titanium.Proxy
Fires a synthesized event to any registered listeners.
| Parameters | Type | Description |
|---|---|---|
| name | String | Name of the event. |
| event? | Dictionary | A dictionary of keys and values to add to the Titanium.Event object sent to the listeners. |
Fetches a shortcut item by its unique string identifier.
Returns a shortcut item with a matching string id.
Returns null if a match was not found.
| Parameters | Type | Description |
|---|---|---|
| id | String | Identifier of shortcut item to obtain. |
Removes the given shortcut item from the application.
| Parameters | Type | Description |
|---|---|---|
| item | Titanium.UI.ShortcutItem | Titanium.UI.ShortcutItem to remove. |
Removes all shortcut items from the application.
Inherited from Titanium.Proxy
Removes the specified callback as an event listener for the named event.
| Parameters | Type | Description |
|---|---|---|
| name | String | Name of the event. |
| callback | Callback<Titanium.Event> | Callback function to remove. Must be the same function passed to 4 fields
|
Events 1
Fired when a Titanium.UI.ShortcutItem was clicked on.
| Event properties | Type | Description |
|---|---|---|
| item | Titanium.UI.ShortcutItem | The shortcut item clicked. |