Handover to the native app that launched the editor.
The editor starts the handover and a later page load can finish it, so this is its own ResourceLoader module. The editor overlays require it by name, and mobile.init loads it only when a handover is waiting.
- Source:
Methods
finishHandover()static
#
Finish a handover which a redirect after saving interrupted, and forget it so that a reload or a shared URL cannot repeat it.
Does nothing if the editor recorded no handover, so a made up URL cannot tell the app about an edit which did not happen.
Finish a handover which a redirect after saving interrupted, and forget it so that a reload or a shared URL cannot repeat it.
init()static
#
Initializes return-to-app functionality, adding hook listeners to editor events and handling any pending handovers that were previously set up.
- Source:
Initializes return-to-app functionality, adding hook listeners to editor events and handling any pending handovers that were previously set up.
isEnabled() → {boolean}static
#
Whether this wiki has a native app to hand over to.
Returns:
- Type
- boolean
- Source:
redirectToApp(saved, [revId])static
#
Send the browser to the native app that launched the editor, telling it how the edit ended. Depending on what MFReturnToAppBehavior is set to config, this will either happen immediately, or show a banner allowing the user to return to the app when they're ready.
The app registers the configured scheme, so the operating system hands the URL back to it.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
saved |
boolean | Whether the edit was published |
|
revId |
number |
optional |
Id of the new revision, if one was created |
Send the browser to the native app that launched the editor, telling it how the edit ended.
savedQuery() → {string}static
#
Query string that tells a later page load to finish a handover, for when saving asks the frontend to redirect to another URL.
The parameter is only a hint. Session storage holds what that page load needs, and is also what proves that the handover is real.
Returns:
- Type
- string
Query string that tells a later page load to finish a handover, for when saving asks the frontend to redirect to another URL.
setPendingHandover([revId])static
#
Record that a handover must finish on a later page load, and keep the revision id, which that page load cannot work out.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
revId |
number |
optional |
Id of the new revision, if one was created |
Record that a handover must finish on a later page load, and keep the revision id, which that page load cannot work out.
attachReturnToAppBanner(returnUrl)inner
#
Attaches a banner to the top of the document with a link to return to the native app. This is idempotent; e.g. if a banner is already present, this does nothing.
Parameters:
| Name | Type | Description |
|---|---|---|
returnUrl |
string | URL to link to for the return action |
Attaches a banner to the top of the document with a link to return to the native app.