Skip to content

Commit a236b8a

Browse files
committed
make expiration methods not return optional values and update docstring
1 parent 2d13144 commit a236b8a

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/matrixrtc/CallMembership.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,29 +117,29 @@ export class CallMembership {
117117
}
118118

119119
/**
120-
* Gets the absolute expiry time of the membership if applicable to this membership type.
120+
* Gets the absolute expiry timestamp of the membership.
121121
* @returns The absolute expiry time of the membership as a unix timestamp in milliseconds or undefined if not applicable
122122
*/
123-
public getAbsoluteExpiry(): number | undefined {
123+
public getAbsoluteExpiry(): number {
124124
// TODO: calculate this from the MatrixRTCSession join configuration directly
125125
return this.createdTs() + (this.membershipData.expires ?? DEFAULT_EXPIRE_DURATION);
126126
}
127127

128128
/**
129129
* @returns The number of milliseconds until the membership expires or undefined if applicable
130130
*/
131-
public getMsUntilExpiry(): number | undefined {
131+
public getMsUntilExpiry(): number {
132132
// Assume that local clock is sufficiently in sync with other clocks in the distributed system.
133133
// We used to try and adjust for the local clock being skewed, but there are cases where this is not accurate.
134134
// The current implementation allows for the local clock to be -infinity to +MatrixRTCSession.MEMBERSHIP_EXPIRY_TIME/2
135-
return this.getAbsoluteExpiry()! - Date.now();
135+
return this.getAbsoluteExpiry() - Date.now();
136136
}
137137

138138
/**
139139
* @returns true if the membership has expired, otherwise false
140140
*/
141141
public isExpired(): boolean {
142-
return this.getMsUntilExpiry()! <= 0;
142+
return this.getMsUntilExpiry() <= 0;
143143
}
144144

145145
public getPreferredFoci(): Focus[] {

0 commit comments

Comments
 (0)