Iterate PR

This commit is contained in:
Michael Telatynski 2021-06-22 22:23:09 +01:00
parent 6fd1dc7d18
commit e0ac200e27
3 changed files with 9 additions and 9 deletions

View file

@ -25,7 +25,7 @@ export class DecryptionFailure {
}
}
type Fn = (count: number, trackedErrCode: string) => void;
type TrackingFn = (count: number, trackedErrCode: string) => void;
type ErrCodeMapFn = (errcode: string) => string;
export class DecryptionFailureTracker {
@ -73,7 +73,7 @@ export class DecryptionFailureTracker {
* @param {function?} errorCodeMapFn The function used to map error codes to the
* trackedErrorCode. If not provided, the `.code` of errors will be used.
*/
constructor(private readonly fn: Fn, private readonly errorCodeMapFn?: ErrCodeMapFn) {
constructor(private readonly fn: TrackingFn, private readonly errorCodeMapFn?: ErrCodeMapFn) {
if (!fn || typeof fn !== 'function') {
throw new Error('DecryptionFailureTracker requires tracking function');
}

View file

@ -505,7 +505,7 @@ export function bodyToHtml(content: IContent, highlights: string[], opts: IOpts
* @param {object} [options] Options for linkifyString. Default: linkifyMatrix.options
* @returns {string} Linkified string
*/
export function linkifyString(str: string, options = linkifyMatrix.options) {
export function linkifyString(str: string, options = linkifyMatrix.options): string {
return _linkifyString(str, options);
}
@ -516,7 +516,7 @@ export function linkifyString(str: string, options = linkifyMatrix.options) {
* @param {object} [options] Options for linkifyElement. Default: linkifyMatrix.options
* @returns {object}
*/
export function linkifyElement(element: HTMLElement, options = linkifyMatrix.options) {
export function linkifyElement(element: HTMLElement, options = linkifyMatrix.options): HTMLElement {
return _linkifyElement(element, options);
}

View file

@ -30,24 +30,24 @@ export default class EditorStateTransfer {
constructor(private readonly event: MatrixEvent) {}
setEditorState(caret: Caret, serializedParts: SerializedPart[]) {
public setEditorState(caret: Caret, serializedParts: SerializedPart[]) {
this.caret = caret;
this.serializedParts = serializedParts;
}
hasEditorState() {
public hasEditorState() {
return !!this.serializedParts;
}
getSerializedParts() {
public getSerializedParts() {
return this.serializedParts;
}
getCaret() {
public getCaret() {
return this.caret;
}
getEvent() {
public getEvent() {
return this.event;
}
}