Options
All
  • Public
  • Public/Protected
  • All
Menu

Module src/store

The Store module provides methods to save, retrieve and manipulate store. It gathers all children modules and store their references in a single store class, which is provided as a Mixin

Index

Type aliases

ConsoleLevel

ConsoleLevel: "info" | "error" | "warn"

the noti level type corresponds to the three different log levels available in Console

see

console.info

see

console.warn

see

console.error

DisplayJSONShort

DisplayJSONShort: [number, any]

NotiClass

NotiClass: "info" | "danger" | "success" | "warning"

the noti class type corresponds to the bootstrap color classes

StoreModule

StoreModule<State, JSONState>: State & StorageItem<State, JSONState>

A Store Module must have

Type parameters

  • State

  • JSONState

    the JSON representation of its state

    and the three methods defined by StorageItem

TimeSlot

TimeSlot: [boolean, boolean, boolean, boolean, boolean, boolean, boolean, string, string]

index 0 - 6: whether Mo - Su are selected

7: start time, of 24 hour format

8: end time, of 24 hour format

TimeSlotShort

TimeSlotShort: [number, string, string]

Variables

Const CLAS

CLAS: {} = Object.freeze({info: 'info',error: 'danger',warn: 'warning',success: 'success'}) as { [x in ConsoleLevel | 'success']: NotiClass }

map console types to bootstrap css classes

Type declaration

Const CONS

CONS: {} = Object.freeze({info: 'info',danger: 'error',success: 'info',warning: 'warn'}) as { [x in NotiClass]: ConsoleLevel }

map bootstrap css classes to notification type

Type declaration

Const LEVELS

LEVELS: {} = Object.freeze({info: 0,success: 1,warning: 2,danger: 3})

Type declaration

Const compare

compare: CompareCandidate[] = []

Let pendingStatusSave

pendingStatusSave: number = 0

Functions

_saveStatus

  • _saveStatus(): void

bound

  • bound(num: number, low: number, high: number): number

compressJSON

  • compressJSON(jsonString: string): [string, string, string, string, DisplayJSONShort, [number, number, number[], number[], [number, string, string][], ScheduleAll<-1 | number[][]>], [number, number, number, number, [ScheduleAll<-1 | number[][]>, EventJSON][]], {}]

getDefaultOptions

isAncient

  • isAncient(parsed: any): parsed is AncientStorage

isLegacy

  • isLegacy(parsed: any): parsed is LegacyStorage

parseFromURL

  • author

    Zichao Hu, Hanzhi Zhou

    note

    JSON decompression requires the catalog of the semester to be pre-loaded, because the reference schedule conversion in filter requires it

    Parameters

    • config: string

    Returns Promise<SemesterStorage>

saveStatus

  • saveStatus(): void
  • save all store modules to localStorage

    note

    this function needs to be separated from the Store class because it is used in the [[schedule]] sub-module, and the [[schedule]] sub-module does not have access to the Store class

    Returns void

Object literals

Const defaultOptions

defaultOptions: object

a list of sort options with default values assigned

mode

mode: combined = SortMode.combined

sortBy

sortBy: ({ description: string; enabled: true; exclusive: "IamFeelingLucky"[]; idx: number; name: "distance"; reverse: false; title: string; weight: number } | { description: string; enabled: true; exclusive: "IamFeelingLucky"[]; idx: number; name: "variance"; reverse: false; title: string; weight: number } | { description: string; enabled: false; exclusive: "IamFeelingLucky"[]; idx: number; name: "compactness"; reverse: false; title: string; weight: number } | { description: string; enabled: false; exclusive: "IamFeelingLucky"[]; idx: number; name: "lunchTime"; reverse: false; title: string; weight: number } | { description: string; enabled: false; exclusive: "IamFeelingLucky"[]; idx: number; name: "noEarly"; reverse: false; title: string; weight: number } | { description: string; enabled: false; exclusive: "IamFeelingLucky"[]; idx: number; name: "similarity"; reverse: false; title: string; weight: number } | { description: string; enabled: false; exclusive: ("variance" | "compactness" | "lunchTime" | "noEarly" | "distance")[]; idx: number; name: "IamFeelingLucky"; reverse: false; title: string; weight: number })[] = [{name: 'distance',enabled: true,reverse: false,idx: 0,weight: 1,exclusive: ['IamFeelingLucky'],title: 'Walking Distance',description: 'Avoid long distance walking between classes'},{name: 'variance',enabled: true,reverse: false,idx: 1,weight: 1,exclusive: ['IamFeelingLucky'],title: 'Variance',description: 'Balance the class time each day'},{name: 'compactness',enabled: false,reverse: false,idx: 2,weight: 1,exclusive: ['IamFeelingLucky'],title: 'Vertical compactness',description: 'Make classes back-to-back'},{name: 'lunchTime',enabled: false,reverse: false,idx: 3,weight: 1,exclusive: ['IamFeelingLucky'],title: 'Lunch Time',description: 'Leave spaces for lunch'},{name: 'noEarly',enabled: false,reverse: false,idx: 4,weight: 1,exclusive: ['IamFeelingLucky'],title: 'No Early',description: 'Start my day as late as possible'},{name: 'similarity',enabled: false,reverse: false,idx: 5,weight: 1,exclusive: ['IamFeelingLucky'],title: 'Similarity',description: 'Similar to a selected schedule'},{name: 'IamFeelingLucky',enabled: false,reverse: false,idx: 6,weight: 1,exclusive: ['variance', 'compactness', 'lunchTime', 'noEarly', 'distance'],title: `I'm Feeling Lucky`,description: 'Sort randomly'}]

fromJSON

toJSON

  • toJSON(): { mode: SortMode; sortBy: { enabled: boolean; idx: number; name: SortFunctionNames; reverse: boolean; weight: number }[] }

Generated using TypeDoc