Exposes more Handoff related APIs to Electron.

This commit is contained in:
Rafael Nobre 2017-06-26 16:14:44 -03:00 committed by Cheng Zhao
parent 787675ab08
commit a870799c32
9 changed files with 234 additions and 5 deletions

View file

@ -149,6 +149,53 @@ ID as the activity's source app and that supports the activity's type.
Supported activity types are specified in the app's `Info.plist` under the
`NSUserActivityTypes` key.
### Event: 'will-continue-activity' _macOS_
Returns:
* `event` Event
* `type` String - A string identifying the activity. Maps to
[`NSUserActivity.activityType`][activity-type].
Emitted during [Handoff][handoff] before an activity from a different device wants
to be resumed. You should call `event.preventDefault()` if you want to handle
this event.
### Event: 'continue-activity-error' _macOS_
Returns:
* `event` Event
* `type` String - A string identifying the activity. Maps to
[`NSUserActivity.activityType`][activity-type].
* `error` String - A string with the error's localized description.
Emitted during [Handoff][handoff] when an activity from a different device
fails to be resumed.
### Event: 'activity-was-continued' _macOS_
Returns:
* `event` Event
* `type` String - A string identifying the activity. Maps to
[`NSUserActivity.activityType`][activity-type].
* `userInfo` Object - Contains app-specific state stored by the activity.
Emitted during [Handoff][handoff] after an activity from this device was successfully
resumed.
### Event: 'update-activity-state' _macOS_
Returns:
* `event` Event
* `type` String - A string identifying the activity. Maps to
[`NSUserActivity.activityType`][activity-type].
* `userInfo` Object - Contains app-specific state stored by the activity.
Emitted during [Handoff][handoff] when its user info should be updated before resuming.
### Event: 'new-window-for-tab' _macOS_
Returns:
@ -748,6 +795,25 @@ is eligible for [Handoff][handoff] to another device afterward.
Returns `String` - The type of the currently running activity.
### `app.invalidateCurrentActivity()` _macOS_
* `type` String - Uniquely identifies the activity. Maps to
[`NSUserActivity.activityType`][activity-type].
* `userInfo` Object - App-specific state to store for use by another device.
* `webpageURL` String (optional) - The webpage to load in a browser if no suitable app is
installed on the resuming device. The scheme must be `http` or `https`.
Invalidates de current Handoff user activity.
### `app.updateCurrentActivity(type, userInfo[, webpageURL])` _macOS_
* `type` String - Uniquely identifies the activity. Maps to
[`NSUserActivity.activityType`][activity-type].
* `userInfo` Object - App-specific state to store for use by another device.
Updates the current `NSUserActivity` if its type matches `type`, merging the entries from
`userInfo` into its current userInfo dictionary.
### `app.setAppUserModelId(id)` _Windows_
* `id` String