Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/blimpio/cordova-plugin-3dtouch-shortcutitems
https://github.com/blimpio/cordova-plugin-3dtouch-shortcutitems
Last synced: 5 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/blimpio/cordova-plugin-3dtouch-shortcutitems
- Owner: blimpio
- License: mit
- Created: 2015-10-09T15:01:09.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-10-10T15:24:04.000Z (about 9 years ago)
- Last Synced: 2024-10-12T10:41:11.427Z (25 days ago)
- Language: Objective-C
- Homepage:
- Size: 113 KB
- Stars: 5
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cordova-plugin-3dtouch-shorcutitem
by [Giovanni Collazo](http://twitter.com/gcollazo)## Description
* This plugin will notify you JavaScript app when you app is launched or resumed using a UIApplicationShortcutItem.
* The plugin will call `window.onShortcutEvent` and pass an object. The `data` property of that object contains the `UIApplicationShortcutItemType` of the shortcut used.
## Installation
```
$ cordova plugin add cordova-plugin-3dtouch-shortcutitems
```## Xcode Project Setup
For custom shortcut icon create an Asset catalog and add your images. In this example the custom image used is called `my-shortcut-icon`. Set the text for the shortcut, in this example we are using `Shortcut Title`. Finally set the type of the shortcut, we are using `com.example.quicklink.action`.### Project.plist
```xml
UIApplicationShortcutItems
UIApplicationShortcutItemIconFile
my-shortcut-icon
UIApplicationShortcutItemTitle
Shortcut Title
UIApplicationShortcutItemType
com.example.quicklink.action
```
[UIApplicationShortcutItems Reference](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/doc/uid/TP40009252-SW36)
## JavaScript Interface
```js
// Register callback
window.onShortcutEvent = function(event) {
alert(event.data);
};// Initialize properly
document.addEventListener('deviceready', function() {
window.shortcutItem.initialize();
}, false);
```