Class Duration (4.8.0)

Duration class with an interface similar to the tc39 Temporal proposal. Since it's not fully finalized, and polyfills have inconsistent compatibility, for now this shim class will be used to set durations in Pub/Sub.

This class will remain here for at least the next major version, eventually to be replaced by the tc39 Temporal built-in.

https://tc39.es/proposal-temporal/docs/duration.html

Package

@google-cloud/pubsub

Methods

from(durationLike)

  static 
  
 from 
 ( 
 durationLike 
 : 
  
 DurationLike 
 ) 
 : 
  
 Duration 
 ; 
 

Creates a Duration from a DurationLike, which is an object containing zero or more of the following: hours, seconds, minutes, millis.

Parameter
Name
Description
durationLike
Returns
Type
Description

totalOf(totalOf)

  totalOf 
 ( 
 totalOf 
 : 
  
 TotalOfUnit 
 ) 
 : 
  
 number 
 ; 
 

Calculates the total number of units of type 'totalOf' that would fit inside this duration.

Parameter
Name
Description
totalOf
Returns
Type
Description
number
Design a Mobile Site
View Site in Mobile | Classic
Share by: