Skip to content

Commit 858cb9b

Browse files
authored
Eg pubsub fixes (firebase#729)
* Adding logger SDK to reference, with some edits. * Adding link to structured logging details per feedback. * Adding ScheduleBuilder class to TOC and adding minimal commenting. * Improving wording and format per feedback. * I think we need to document both the schedule function and the builder class this way. * Last edits from feedback.
1 parent ad144e4 commit 858cb9b

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

docgen/content-sources/toc.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ toc:
106106
path: /docs/reference/functions/providers_pubsub_.message.html
107107
- title: 'TopicBuilder'
108108
path: /docs/reference/functions/providers_pubsub_.topicbuilder.html
109+
- title: 'ScheduleBuilder'
110+
path: /docs/reference/functions/providers_pubsub_.schedulebuilder.html
109111

110112
- title: 'functions.remoteconfig'
111113
path: /docs/reference/functions/providers_remoteconfig_.html

src/providers/pubsub.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ export class TopicBuilder {
9898
}
9999
}
100100

101+
/**
102+
* Registers a Cloud Function to run at specified times.
103+
*
104+
* @param schedule The schedule, in Unix Crontab or AppEngine syntax.
105+
* @return ScheduleBuilder interface.
106+
*/
101107
export function schedule(schedule: string): ScheduleBuilder {
102108
return _scheduleWithOptions(schedule, {});
103109
}
@@ -120,6 +126,15 @@ export function _scheduleWithOptions(
120126
});
121127
}
122128

129+
/**
130+
* The builder for scheduled functions, which are powered by
131+
* Google Pub/Sub and Cloud Scheduler. Describes the Cloud Scheduler
132+
* job that is deployed to trigger a scheduled function at the provided
133+
* frequency. For more information, see
134+
* [Schedule functions](/docs/functions/schedule-functions).
135+
*
136+
* Access via [`functions.pubsub.schedule()`](providers_pubsub_.html#schedule).
137+
*/
123138
export class ScheduleBuilder {
124139
/** @hidden */
125140
constructor(
@@ -137,6 +152,14 @@ export class ScheduleBuilder {
137152
return this;
138153
}
139154

155+
/**
156+
* Event handler for scheduled functions. Triggered whenever the associated
157+
* scheduler job sends a Pub/Sub message.
158+
*
159+
* @param handler Handler that fires whenever the associated
160+
* scheduler job sends a Pub/Sub message.
161+
* @return A Cloud Function that you can export and deploy.
162+
*/
140163
onRun(handler: (context: EventContext) => PromiseLike<any> | any) {
141164
const cloudFunction = makeCloudFunction({
142165
contextOnlyHandler: handler,

0 commit comments

Comments
 (0)