mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 21:00:01 +08:00
# Conflicts: # amcharts/AmCharts.d.ts # angular-gettext/angular-gettext.d.ts # angular-jwt/angular-jwt.d.ts # angular-material/angular-material.d.ts # angularjs/angular.d.ts # auth0-js/auth0-js.d.ts # aws-lambda/aws-lambda.d.ts # aws-sdk/aws-sdk.d.ts # azure-mobile-apps/azure-mobile-apps.d.ts # azure-mobile-services-client/AzureMobileServicesClient.d.ts # blessed/blessed-tests.ts # blessed/blessed.d.ts # bootbox/bootbox.d.ts # bowser/bowser.d.ts # cache-manager/cache-manager.d.ts # chai-things/chai-things.d.ts # colors/colors.d.ts # cordova/cordova-tests.ts # cordova/plugins/Contacts.d.ts # cordova/plugins/FileSystem.d.ts # couchbase/couchbase.d.ts # cucumber/cucumber-tests.ts # cucumber/cucumber.d.ts # d3/d3.d.ts # dojo/dojo.d.ts # dustjs-linkedin/dustjs-linkedin.d.ts # esprima/esprima.d.ts # express-serve-static-core/express-serve-static-core.d.ts # express-session/express-session.d.ts # fetch-mock/fetch-mock.d.ts # fs-extra/fs-extra.d.ts # fullCalendar/fullCalendar.d.ts # github-electron/github-electron.d.ts # gulp-uglify/gulp-uglify.d.ts # gulp/gulp.d.ts # highcharts/highcharts.d.ts # imap/imap.d.ts # incremental-dom/incremental-dom.d.ts # inversify/inversify.d.ts # ionic/ionic.d.ts # ioredis/ioredis.d.ts # isomorphic-fetch/isomorphic-fetch-tests.ts # jake/jake.d.ts # joi/joi.d.ts # jquery-mockjax/jquery-mockjax.d.ts # jquery/jquery.d.ts # js-data-http/js-data-http-tests.ts # js-data-http/js-data-http.d.ts # js-data/js-data.d.ts # jsdom/jsdom.d.ts # jsts/jsts-tests.ts # knex/knex.d.ts # koa-favicon/koa-favicon.d.ts # koa-router/koa-router-tests.ts # koa-router/koa-router.d.ts # lodash/lodash.d.ts # mailparser/mailparser.d.ts # maquette/maquette.d.ts # material-ui/material-ui.d.ts # matter-js/matter-js.d.ts # moment/moment.d.ts # mongoose-promise/mongoose-promise-tests.ts # mongoose/mongoose-tests.ts # mongoose/mongoose.d.ts # multer/multer.d.ts # ncp/ncp.d.ts # nock/nock.d.ts # node/node-tests.ts # node/node.d.ts # nvd3/nvd3.d.ts # object-assign/object-assign.d.ts # openlayers/openlayers.d.ts # parse/parse.d.ts # pdf/pdf.d.ts # pdfkit/pdfkit.d.ts # pg/pg.d.ts # pixi.js/pixi.js.d.ts # progress/progress.d.ts # pusher-js/pusher-js.d.ts # quill/quill-tests.ts # quill/quill.d.ts # radium/radium.d.ts # ravenjs/ravenjs-tests.ts # react-dropzone/react-dropzone.d.ts # react-mdl/react-mdl.d.ts # react-native/react-native.d.ts # react-notification-system/react-notification-system.d.ts # react-router/history-tests.ts # react-router/react-router-tests.tsx # react-router/react-router.d.ts # react-select/react-select-tests.tsx # react-select/react-select.d.ts # react/react.d.ts # redux-form/redux-form.d.ts # request-promise/request-promise.d.ts # resolve-from/resolve-from.d.ts # riot-api-nodejs/riot-api-nodejs.d.ts # sanitize-html/sanitize-html.d.ts # segment-analytics/segment-analytics.d.ts # simple-assign/simple-assign-tests.ts # simple-assign/simple-assign.d.ts # slate-irc/slate-irc.d.ts # soap/soap.d.ts # socket.io/socket.io.d.ts # sql.js/sql.js-tests.ts # sql.js/sql.js.d.ts # steam/steam.d.ts # stylus/stylus.d.ts # swiper/swiper.d.ts # tedious/tedious.d.ts # threejs/three.d.ts # twilio/twilio.d.ts # underscore/underscore.d.ts # ws/ws.d.ts # yeoman-generator/yeoman-generator.d.ts
188 lines
7.8 KiB
TypeScript
188 lines
7.8 KiB
TypeScript
// 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
|
|
|
|
declare namespace PebbleKit {
|
|
|
|
interface Error {
|
|
message: string;
|
|
}
|
|
|
|
interface Event {
|
|
type: string;
|
|
payload?: Object;
|
|
response?: string;
|
|
}
|
|
|
|
interface Layout {
|
|
icon: string;
|
|
subtitleTemplateString: string;
|
|
}
|
|
|
|
/**
|
|
* The structure of an app glance.
|
|
*/
|
|
interface AppGlanceSlice {
|
|
expirationTime?: string;
|
|
layout: Layout;
|
|
}
|
|
|
|
interface AppMessageData {
|
|
transactionId: string;
|
|
}
|
|
|
|
interface AppMessageEvent {
|
|
data: AppMessageData;
|
|
error?: Error;
|
|
}
|
|
|
|
/**
|
|
* Object containing firmware version information.
|
|
*/
|
|
interface Firmware {
|
|
major: number;
|
|
minor: number;
|
|
patch: number;
|
|
suffix: string;
|
|
}
|
|
|
|
/**
|
|
* Object containing information about the currently connected watch,
|
|
* returned by Pebble.getActiveWatchInfo().
|
|
* Read the PebbleKit JS guides for complete information on possible values.
|
|
* @see Pebble.getActiveWatchInfo
|
|
*/
|
|
interface WatchInfo {
|
|
platform: string;
|
|
model: string;
|
|
language: string;
|
|
firmware: Firmware;
|
|
}
|
|
|
|
interface Pebble {
|
|
/**
|
|
* Adds a listener for Pebble JS events, such as when an AppMessage is received or the configuration view is opened or closed.
|
|
* @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.
|
|
*/
|
|
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.
|
|
* See Pebble.addEventListener() for a list of available types.
|
|
* @param callback The existing developer-defined function that was previously registered.
|
|
* @see addEventListener
|
|
*/
|
|
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
|
|
*
|
|
* @param body The main content of the notification.
|
|
*/
|
|
showSimpleNotificationOnPebble(title: string, body: string): void;
|
|
|
|
/**
|
|
* Send an AppMessage to the app running on the watch.
|
|
* Messages should be in the form of JSON objects containing key-value pairs.
|
|
* @param jsonAppMessage A JSON object containing key-value pairs to send to the watch.
|
|
* Values in arrays that are greater then 255 will be mod 255 before sending.
|
|
* @param callbackForAck The developer-defined function to run if the watch acknowledges (ACK) this message.
|
|
* @param callbackForNack The developer-defined function to run if the watch does not acknowledge (NACK) this message.
|
|
* @return string
|
|
*/
|
|
sendAppMessage(jsonAppMessage: Object, callbackForAck?: (e: AppMessageEvent) => void, callbackForNack?: (e: AppMessageEvent) => void): string;
|
|
|
|
/**
|
|
* Get the user's timeline token for this app. This is a string and is unique per user per app.
|
|
* Note: In order for timeline tokens to be available, the app must be submitted to the Pebble appstore,
|
|
* but does not need to be public. Read more in the timeline guides
|
|
* @param successCallback
|
|
* @param failureCallback
|
|
*/
|
|
getTimelineToken(successCallback: (token: string) => void, failureCallback: (error: string) => void): void;
|
|
|
|
/**
|
|
* Subscribe the user to a timeline topic for your app.
|
|
* This can be used to filter the different pins a user could receive according to their preferences,
|
|
* as well as maintain groups of users.
|
|
* @param topic The desired topic to be subscribed to. Users will receive all pins pushed to this topic.
|
|
* @param successCb The developer-defined function to handle a successful subscription attempt.
|
|
* @param errorCb The developer-defined function to gracefully handle a failed subscription attempt.
|
|
*/
|
|
timelineSubscribe(topic: string, successCb: () => void, errorCb: (errorString: string) => void): void;
|
|
|
|
/**
|
|
* Unsubscribe a user from a timeline topic for this app. Once unsubscribed,
|
|
* the user will no longer receive any pins pushed to this topic.
|
|
* @param topic The topic the user is to be unsubscribed from.
|
|
* @param successCb The developer-defined function to handle a successful unsubscription attempt.
|
|
* @param errorCb The developer-defined function to gracefully handle a failed unsubscription attempt.
|
|
*/
|
|
timelineUnsubscribe(topic: string, successCb: () => void, errorCb: (errorString: string) => void): void;
|
|
|
|
/**
|
|
* Obtain a list of topics that the user is currently subscribed to.
|
|
* The length of the list should be checked to determine whether the user is subscribed to at least one topic.
|
|
* @param successCb The developer-defined function to process the retuned list of topic strings.
|
|
* @param errorCb The developer-defined function to gracefully handle any errors in obtaining the user's subscriptions.
|
|
*/
|
|
timelineSubscriptions(successCb: (topics: string[]) => void, errorCb: (errorString: string) => void): void;
|
|
|
|
/**
|
|
* Returns a unique account token that is associated with the Pebble account of the current user.
|
|
* @return WatchInfo
|
|
*/
|
|
getActiveWatchInfo(): WatchInfo;
|
|
|
|
/**
|
|
* Returns a unique account token that is associated with the Pebble account of the current user.
|
|
* @return string
|
|
*/
|
|
getAccountToken(): string;
|
|
|
|
/**
|
|
* Returns a a unique token that can be used to identify a Pebble device.
|
|
* @return string
|
|
*/
|
|
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
|
|
*/
|
|
openURL(url: string): void;
|
|
}
|
|
}
|
|
|
|
declare var Pebble: PebbleKit.Pebble;
|