File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { sendAppMessage } from "./appMessage" ;
2- import { getTimelineToken } from "./timeline" ;
2+ import {
3+ getTimelineToken ,
4+ insertTimelinePin ,
5+ deleteTimelinePin ,
6+ } from "./timeline" ;
37import { fetchString , fetchJSON , fetchBinary } from "./fetch" ;
48
59export default {
610 sendAppMessage,
711 getTimelineToken,
12+ insertTimelinePin,
13+ deleteTimelinePin,
814 fetchString,
915 fetchJSON,
1016 fetchBinary,
Original file line number Diff line number Diff line change @@ -7,3 +7,29 @@ export function getTimelineToken(): Promise<string> {
77 Pebble . getTimelineToken ( resolve , reject ) ;
88 } ) ;
99}
10+
11+ /**
12+ * Adds a timeline pin to the user's timeline.
13+ * Only works on the Core Devices app. This function will throw when not available.
14+ * @param pin - TimelinePin object or string
15+ * @throws Error if insertTimelinePin is not available
16+ */
17+ export function insertTimelinePin ( pin : TimelinePin | string ) : void {
18+ if ( ! Pebble . insertTimelinePin ) {
19+ throw new Error ( "insertTimelinePin is not available" ) ;
20+ }
21+ Pebble . insertTimelinePin ( pin ) ;
22+ }
23+
24+ /**
25+ * Deletes a pin from the user's timeline by id.
26+ * Only works on the Core Devices app. This function will throw when not available.
27+ * @param id - The ID of the timeline pin to remove
28+ * @throws Error if removeTimelinePin is not available
29+ */
30+ export function deleteTimelinePin ( id : string ) : void {
31+ if ( ! Pebble . deleteTimelinePin ) {
32+ throw new Error ( "deleteTimelinePin is not available" ) ;
33+ }
34+ Pebble . deleteTimelinePin ( id ) ;
35+ }
You can’t perform that action at this time.
0 commit comments