Pebble App Framework: Phone API
    Preparing search index...
    default: {
        createSourceSubscription: (
            options: SubscriptionOptions,
        ) => SourceSubscription;
        ENDING_CODES: readonly string[];
        NO_PLUGIN: string;
        QUICK_RETRY_MS: number;
        QUICK_RETRY_WINDOW_MS: number;
    }

    Type Declaration

    • createSourceSubscription: (options: SubscriptionOptions) => SourceSubscription
    • ENDING_CODES: readonly string[]

      The error codes after which the phone has ended the subscription itself, so nothing more arrives until it is started again. The phone sends PLUGIN_UNAVAILABLE at subscribe time when nothing serves the item, and returns before starting. An error raised while one runs, such as PERMISSION_DENIED before the wearer allows Location, leaves it running and data follows once the wearer allows it.

      PERMISSION_DENIED also ends the job in two rare cases, an app the phone thinks is not installed and a legacy caller. It is treated as live anyway, since the common case keeps running, and a later ready starts afresh. INVALID_REQUEST ends it too but is left off, since a retry sends the same request and fails the same way.

    • NO_PLUGIN: string

      The code a subscription reports itself when no installed plugin serves its item.

    • QUICK_RETRY_MS: number

      How often an idle unit in plugin mode tries again on its own, in milliseconds. A plugin the wearer has just installed or turned on then shows up within minutes rather than at the slow tick. Reading the phone's plugin list is a local call, so a retry costs nothing on the network.

    • QUICK_RETRY_WINDOW_MS: number

      How long the quick retry runs, in milliseconds, before it stops and leaves the slow tick to carry on. The quick retry is there to catch a plugin the wearer is setting up right now. With plugins left off, or a Pebble app from before plugins, it would otherwise wake PebbleKit JS every two minutes for the whole session. A start, a save while the plugin is picked, and opening the settings page each give it the full time again. Its own retries do not.

      The window is counted in retries, 15 of them, and a retry is only spent while the unit sits idle. So a subscription that goes live and ends hours later, such as when the wearer turns plugins off, still has its 30 minutes of quick retries left then. That costs at most 15 more reads of the phone's plugin list, all local. It is worth it because it catches the wearer turning plugins back on within minutes rather than at the next slow tick.