クロックトリガーのビルダー。
Methods
メソッド | 戻り値の型 | 概要 |
---|---|---|
after(durationMilliseconds) | ClockTriggerBuilder | 現在のトリガー実行時刻以降の最小期間(ミリ秒単位)を指定します。 |
at(date) | ClockTriggerBuilder | トリガーの実行タイミングを指定します。 |
atDate(year, month, day) | ClockTriggerBuilder | 指定した日付にトリガーを起動するように指定します。デフォルトでは深夜 0 時前後(+/- 15 分)にトリガーが発動します。 |
atHour(hour) | ClockTriggerBuilder | トリガーを実行する時間を指定します。 |
create() | Trigger | トリガーを作成する。 |
everyDays(n) | ClockTriggerBuilder | トリガーを n 日ごとに実行するよう指定します。 |
everyHours(n) | ClockTriggerBuilder | トリガーを n 時間ごとに実行するよう指定します。 |
everyMinutes(n) | ClockTriggerBuilder | トリガーを n 分ごとに実行するよう指定します。 |
everyWeeks(n) | ClockTriggerBuilder | トリガーを n 週間ごとに実行するよう指定します。 |
inTimezone(timezone) | ClockTriggerBuilder | トリガーの実行時に指定した日時のタイムゾーンを指定します。 |
nearMinute(minute) | ClockTriggerBuilder | トリガーを実行する分を指定します(プラスまたはマイナス 15 分)。 |
onMonthDay(day) | ClockTriggerBuilder | トリガーを実行する月の日付を指定します。 |
onWeekDay(day) | ClockTriggerBuilder | トリガーを実行する曜日を指定します。 |
詳細なドキュメント
after(durationMilliseconds)
現在のトリガー実行時刻以降の最小期間(ミリ秒単位)を指定します。実際の期間は異なる場合がありますが、指定した最短期間より短くはなりません。
// Creates a trigger that runs 10 minutes later ScriptApp.newTrigger("myFunction") .timeBased() .after(10 * 60 * 1000) .create();
パラメータ
名前 | 型 | 説明 |
---|---|---|
durationMilliseconds | Integer | 現在時刻からトリガーを実行する最小継続時間(ミリ秒単位)。 |
リターン
ClockTriggerBuilder
- チェーン用のビルダー。
at(date)
トリガーの実行タイミングを指定します。
// Creates a trigger for December 1, 2012 var triggerDay = new Date(2012, 11, 1); ScriptApp.newTrigger("myFunction") .timeBased() .at(triggerDay) .create();
パラメータ
名前 | 型 | 説明 |
---|---|---|
date | Date | トリガーの実行タイミングを表す Date オブジェクト。 |
リターン
ClockTriggerBuilder
- チェーン用のビルダー。
atDate(year, month, day)
指定した日付にトリガーを起動するように指定します。デフォルトでは深夜 0 時前後(前後 15 分前)にトリガーが発動します。
// Schedules for January 1st, 2013 ScriptApp.newTrigger("myFunction") .timeBased() .atDate(2013, 1, 1) .create();
パラメータ
名前 | 型 | 説明 |
---|---|---|
year | Integer | トリガーをスケジュールする年。 |
month | Integer | トリガーをスケジュールする月(1 ~ 12 の範囲内の数値)。 |
day | Integer | トリガーをスケジュールするカレンダーの日付(1 ~ 31 の数値で指定する必要があります)。 |
リターン
ClockTriggerBuilder
- チェーン用のビルダー。
atHour(hour)
トリガーを実行する時間を指定します。
// Runs between 5am-6am in the timezone of the script ScriptApp.newTrigger("myFunction") .timeBased() .atHour(5) .everyDays(1) // Frequency is required if you are using atHour() or nearMinute() .create();
パラメータ
名前 | 型 | 説明 |
---|---|---|
hour | Integer | 配信する時間です。 |
リターン
ClockTriggerBuilder
- チェーン用のビルダー。
create()
everyDays(n)
トリガーを n
日ごとに実行するよう指定します。
ScriptApp.newTrigger("myFunction") .timeBased() .everyDays(3) .create();
パラメータ
名前 | 型 | 説明 |
---|---|---|
n | Integer | 実行の間隔(日数)。 |
リターン
ClockTriggerBuilder
- チェーン用のビルダー。
everyHours(n)
トリガーを n
時間ごとに実行するよう指定します。
ScriptApp.newTrigger("myFunction") .timeBased() .everyHours(12) .create();
パラメータ
名前 | 型 | 説明 |
---|---|---|
n | Integer | 実行の間隔(時間数)。 |
リターン
ClockTriggerBuilder
- チェーン用のビルダー。
everyMinutes(n)
トリガーを n
分ごとに実行するよう指定します。n
は 1、5、10、15、30 のいずれかにする必要があります。
ScriptApp.newTrigger("myFunction") .timeBased() .everyMinutes(10) .create();
パラメータ
名前 | 型 | 説明 |
---|---|---|
n | Integer | 実行の間隔(分)。 |
リターン
ClockTriggerBuilder
- チェーン用のビルダー。
everyWeeks(n)
トリガーを n
週間ごとに実行するよう指定します。
ScriptApp.newTrigger("myFunction") .timeBased() .everyWeeks(2) .onWeekDay(ScriptApp.WeekDay.FRIDAY) .create();
パラメータ
名前 | 型 | 説明 |
---|---|---|
n | Integer | 実行の間隔(週数)。 |
リターン
ClockTriggerBuilder
- チェーン用のビルダー。
inTimezone(timezone)
トリガーの実行時に指定した日時のタイムゾーンを指定します。デフォルトでは、タイムゾーンはスクリプトのタイムゾーンです。
有効なタイムゾーン文字列のリストは、Joda.org に記載されている有効なタイムゾーン文字列に対応しています。タイムゾーン文字列が無効な場合、スクリプトはエラーをスローします。
// Schedule the trigger to execute at noon every day in the US/Pacific time zone ScriptApp.newTrigger("myFunction") .timeBased() .atHour(12) .everyDays(1) .inTimezone("America/Los_Angeles") .create();
パラメータ
名前 | 型 | 説明 |
---|---|---|
timezone | String | イベントの時刻情報を扱うタイムゾーン。 |
リターン
ClockTriggerBuilder
- この ClockTriggerBuilder
(チェーン用)。
nearMinute(minute)
トリガーを実行する分を指定します(プラスまたはマイナス 15 分)。nearMinute()
が呼び出されない場合、ランダムな「分」の値が使用されます。
// Runs at approximately 5:30am in the timezone of the script ScriptApp.newTrigger("myFunction") .timeBased() .atHour(5) .nearMinute(30) .everyDays(1) // Frequency is required if you are using atHour() or nearMinute() .create();
パラメータ
名前 | 型 | 説明 |
---|---|---|
minute | Integer | 発動する分。 |
リターン
ClockTriggerBuilder
- チェーン用のビルダー。
onMonthDay(day)
トリガーを実行する月の日付を指定します。
// Schedules for the first of every month ScriptApp.newTrigger("myFunction") .timeBased() .onMonthDay(1) .create();
パラメータ
名前 | 型 | 説明 |
---|---|---|
day | Integer | トリガーをスケジュールする日。 |
リターン
ClockTriggerBuilder
- チェーン用のビルダー。
onWeekDay(day)
トリガーを実行する曜日を指定します。
ScriptApp.newTrigger("myFunction") .timeBased() .onWeekDay(ScriptApp.WeekDay.FRIDAY) .create();
パラメータ
名前 | 型 | 説明 |
---|---|---|
day | Weekday | 配信する曜日。 |
リターン
ClockTriggerBuilder
- チェーン用のビルダー。