Skip to content

Commit

Permalink
SLVUU-127: Refactor arrow function signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
pling-scottlogic committed Dec 14, 2023
1 parent 5831e78 commit 5800579
Showing 1 changed file with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,27 +142,24 @@ export class LocalLayoutPersistenceManager implements LayoutPersistenceManager {
});
}

loadLayouts: () => Promise<Layout[]> = () => {
loadLayouts = (): Promise<Layout[]> => {
return new Promise((resolve) => {
const layouts = getLocalEntity<Layout[]>(this.layoutsSaveLocation);
resolve(layouts || []);
});
}

saveLayoutsWithMetadata: (
saveLayoutsWithMetadata = (
layouts: Layout[],
metadata: LayoutMetadata[]
) => void = (
layouts: Layout[],
metadata: LayoutMetadata[]
) => {
): void => {
saveLocalEntity<Layout[]>(this.layoutsSaveLocation, layouts);
saveLocalEntity<LayoutMetadata[]>(this.metadataSaveLocation, metadata);
}

// Ensures that there is exactly one Layout entry and exactly one Metadata
// entry in local storage corresponding to the provided ID.
validateIds: (id: string) => Promise<void> = async (id: string) => {
validateIds = async (id: string): Promise<void> => {
return Promise.all([
this.validateId(id, "metadata").catch((error) => error.message),
this.validateId(id, "layout").catch((error) => error.message),
Expand All @@ -180,13 +177,10 @@ export class LocalLayoutPersistenceManager implements LayoutPersistenceManager {

// Ensures that there is exactly one element (Layout or Metadata) in local
// storage corresponding to the provided ID.
validateId: (
id: string,
dataType: "metadata" | "layout"
) => Promise<void> = (
validateId = (
id: string,
dataType: "metadata" | "layout"
) => {
): Promise<void> => {
return new Promise((resolve, reject) => {
const loadFunc =
dataType === "metadata" ? () => this.loadMetadata() : () => this.loadLayouts();
Expand Down

0 comments on commit 5800579

Please sign in to comment.