Expand all

mobile.returnToApp

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.

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.

Source:

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:
Whether this wiki has a native app to hand over to.

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

Source:

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
Source:

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

Source:

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

Source:

Attaches a banner to the top of the document with a link to return to the native app.

Expand all

mobile.returnToApp

Handles display of the return-to-app banner shown after making an edit.

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.

Source:

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:
Whether this wiki has a native app to hand over to.

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

Source:

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
Source:

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

Source:

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

Source:

Attaches a banner to the top of the document with a link to return to the native app.