mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-22 20:39:17 +08:00
Added api of Pebble OS v4.0 to pebblekitjs
This commit is contained in:
@@ -59,3 +59,18 @@ Pebble.timelineSubscriptions(
|
||||
console.log('Error getting subscriptions: ' + errorString);
|
||||
}
|
||||
);
|
||||
|
||||
Pebble.appGlanceReload(
|
||||
[{
|
||||
layout: {
|
||||
'icon': 'system://images/HOTEL_RESERVATION',
|
||||
'subtitleTemplateString': 'Nice Slice!'
|
||||
}
|
||||
}],
|
||||
function (appGlanceSlices) {
|
||||
console.log('AppGlanceReload is successful');
|
||||
},
|
||||
function (appGlanceSlices) {
|
||||
console.log('AppGlanceReload has failed');
|
||||
}
|
||||
);
|
||||
|
||||
41
pebblekitjs/pebblekitjs.d.ts
vendored
41
pebblekitjs/pebblekitjs.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
// Type definitions for PebbleKit JS
|
||||
// Type definitions for PebbleKit JS v4.0.0
|
||||
// Project: https://developer.pebble.com/docs/js/Pebble/
|
||||
// Definitions by: Makoto Kawasaki <https://github.com/makotokw>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -15,6 +15,19 @@ declare namespace PebbleKit {
|
||||
response?: string;
|
||||
}
|
||||
|
||||
interface Layout {
|
||||
icon: string;
|
||||
subtitleTemplateString: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* The structure of an app glance.
|
||||
*/
|
||||
interface AppGlanceSlice {
|
||||
expirationTime?: string;
|
||||
layout: Layout;
|
||||
}
|
||||
|
||||
interface AppMessageData {
|
||||
transactionId: string;
|
||||
}
|
||||
@@ -55,6 +68,14 @@ declare namespace PebbleKit {
|
||||
*/
|
||||
addEventListener(type: string, callback: (e: Event) => void): void;
|
||||
|
||||
/**
|
||||
* Attaches an event handler to the specified events. Synonymous with addEventListener.
|
||||
* Only applicable to Rocky.js applications.
|
||||
* @param type The type of the event, from the three described above.
|
||||
* @param callback A developer-defined function to receive any events of the type specified that occur.
|
||||
*/
|
||||
on(type: string, callback: (e: Event) => void): void;
|
||||
|
||||
/**
|
||||
* Remove an existing event listener previously registered with Pebble.addEventListener().
|
||||
* @param type The type of the event listener to be removed.
|
||||
@@ -64,6 +85,16 @@ declare namespace PebbleKit {
|
||||
*/
|
||||
removeEventListener(type: string, callback?: (e: Event) => void): void;
|
||||
|
||||
/**
|
||||
* Remove an existing event handler from the specified events. Synonymous with removeEventListener.
|
||||
* Only applicable to Rocky.js applications.
|
||||
* @param type The type of the event listener to be removed.
|
||||
* See Pebble.addEventListener() for a list of available types.
|
||||
* @param callback The existing developer-defined function that was previously registered.
|
||||
* @see addEventListener
|
||||
*/
|
||||
off(type: string, callback?: (e: Event) => void): void;
|
||||
|
||||
/**
|
||||
* Show a simple modal notification on the connected watch.
|
||||
* @param title The title of the notificati
|
||||
@@ -137,6 +168,14 @@ declare namespace PebbleKit {
|
||||
*/
|
||||
getWatchToken(): string;
|
||||
|
||||
/**
|
||||
* Triggers a reload of the app glance which first clears any existing slices and then adds the provided slices.
|
||||
* @param appGlanceSlices
|
||||
* @param onSuccess
|
||||
* @param onFailure
|
||||
*/
|
||||
appGlanceReload(appGlanceSlices: AppGlanceSlice[], onSuccess: (appGlanceSlices: AppGlanceSlice[]) => void, onFailure: (appGlanceSlices: AppGlanceSlice[]) => void): void;
|
||||
|
||||
/**
|
||||
* to start displaying this webview
|
||||
* @param url
|
||||
|
||||
Reference in New Issue
Block a user