moment
RSVP

XML_MIME

src/util.js
XML_MIME

Type: string

JSON_MIME

src/util.js
JSON_MIME

Type: string

TEXT_MIME

src/util.js
TEXT_MIME

Type: string

hasArgs(value: any): boolean
Parameters
value (any)
Returns
boolean

hasNoArgs

src/util.js
hasNoArgs(value: any): boolean
Parameters
value (any)
Returns
boolean

isStringArg

src/util.js
isStringArg(value: any): boolean
Parameters
value (any)
Returns
boolean

isNumArg

src/util.js
isNumArg(value: any): boolean
Parameters
value (any)
Returns
boolean

isObject

src/util.js
isObject(obj: any): boolean
Parameters
obj (any)
Returns
boolean
isDef(v: any): boolean
Parameters
v (any)
Returns
boolean

dataViewToString

src/util.js
dataViewToString(dataView: DataView)
Parameters
dataView (DataView)

stringify

src/util.js

String representation of input. THis is kind of dumb but makes flow happier.

stringify(value: any): string
Parameters
value (any)
Returns
string

calcClockOffset

src/util.js
calcClockOffset(serverTimeUTC: moment): number
Parameters
serverTimeUTC (moment)
Returns
number

StartEndDuration

src/util.js

Any two of startTime, endTime and duration can be specified, or just duration which then assumes endTime is now. startTime and endTime are moment objects, duration is in seconds. clockOffset is the seconds that should be subtracted from the computer time to get real world time, ie computerUTC - UTC or moment.utc().diff(serverTimeUTC, 'seconds', true). default is zero.

new StartEndDuration(startTime: (moment | null), endTime: (moment | null), duration: (moment.duration | number | null), clockOffset: (number | null))
Parameters
startTime ((moment | null))
endTime ((moment | null))
duration ((moment.duration | number | null) = null)
clockOffset ((number | null) = 0)
Instance Members
_startTime
_endTime
_duration
_clockOffset
start
startTime
endTime
duration
clockOffset
overlaps(other)

checkStringOrDate

src/util.js

converts the input value is a moment, throws Error if not a string, Date or moment. Zero length string or "now" return current time.

checkStringOrDate(d: any): moment
Parameters
d (any)
Returns
moment

toIsoWoZ

src/util.js

converts to ISO8601 but removes the trailing Z as FDSN web services do not allow that.

toIsoWoZ(date: moment): string
Parameters
date (moment)
Returns
string

checkProtocol

src/util.js

returns the protocol, http or https for the document if possible.

checkProtocol()

defaultFetchInitObj

src/util.js
defaultFetchInitObj(mimeType: string): {}
Parameters
mimeType (string)
Returns
{}

doFetchWithTimeout

src/util.js
doFetchWithTimeout(url: string, fetchInit: {}, timeoutSec: number): Promise<Response>
Parameters
url (string)
fetchInit ({})
timeoutSec (number)
Returns
Promise<Response>

meanOfSlice

src/util.js

Recursively calculates the mean of a slice of an array. This helps with very long seismograms to equally weight each sample point without overflowing.

meanOfSlice(dataSlice: (Int32Array | Float32Array | Float64Array), totalPts: number): number
Parameters
dataSlice ((Int32Array | Float32Array | Float64Array)) slice of a seismogram
totalPts (number) number of points in the original seismogram
Returns
number: sum of slice data points divided by totalPts