Development: Frontend: Adapters - zhaw-timetable/zhawo GitHub Wiki

Content

IdbAdapter

Adapter used to interact with idb

Kind: global class

idbAdapter.getDBInstance()

Async function that opens idb on client. If idb instance does not exist it creates one.

resolves promise once done

Kind: instance method of IdbAdapter

idbAdapter.getDBTransaction(dbInstance, accessMode)

Function that return dbInstance used to make transactions

Kind: instance method of IdbAdapter

Param Type
dbInstance *
accessMode string

idbAdapter.getUser()

Async function that return the saved user from idb

Kind: instance method of IdbAdapter

idbAdapter.getTheme()

Async function that return saved theme

Kind: instance method of IdbAdapter

idbAdapter.setTheme(theme)

Async function that saves theme to idb

Kind: instance method of IdbAdapter

Param Type
theme string

idbAdapter.setUser(name, type)

Async function saves user to idb

Kind: instance method of IdbAdapter

Param Type
name string
type string

idbAdapter.removeUser()

Async function that removes saved user from db

Kind: instance method of IdbAdapter

idbAdapter.setViewState(value)

Async function that saves current ViewState to idb

Kind: instance method of IdbAdapter

Param Type
value number

idbAdapter.getViewState()

Async function that gets saved ViewState from idb

Kind: instance method of IdbAdapter

idbAdapter.removeViewState()

Async function that removes saved ViewState from idb

Kind: instance method of IdbAdapter

ZHAWo Adapeter

Contains functions that handle everything ZHAW

ZhawoAdapter.exports.getMensaResource(facilityId, date)

Function that make Api call to get Mensa Info for specified mensa

Kind: static method of ZhawoAdapter

Param Type
facilityId number
date string

ZhawoAdapter.exports.getAllMensas()

Function that make api call to get all mensa facilities.

Kind: static method of ZhawoAdapter

ZhawoAdapter.exports.getScheduleResource(route, name, startDate, rangeAroundDate)

Function that gets week schedule for specified user to improve loading time it also loads weeks around specified start date

Kind: static method of ZhawoAdapter

Param Type
route string
name string
startDate Date
rangeAroundDate number

ZhawoAdapter.exports.convertSchedule(schedule)

Function to make rendering of multiple events in the same slot possible, also helps with coordinating which schedules to fetch from the api and allows for nice event indicators in Week Navigation and Month

Receives schedule for exactly one week

Kind: static method of ZhawoAdapter

Param Type
schedule *

ZhawoAdapter.exports.resolveOverlaps(schedule)

Function that rebuilds schedule to resolve resolveOverlaps returns new schedule

Kind: static method of ZhawoAdapter

Param Type
schedule *

ZhawoAdapter.exports.getPossibleNames()

Function makes api call to get all possible user names.

Kind: static method of ZhawoAdapter

ZhawoAdapter.exports.getFreeRoomsJson()

Async Function that makes an api call to get all the Free rooms for the current day. returns array containing all the time slots and the free rooms in said time slot.

Kind: static method of ZhawoAdapter

ZhawoAdapter.exports.convertFreeRooms(freeRooms)

Function that converts freeRooms Object to an array.

Kind: static method of ZhawoAdapter

Param Type
freeRooms *

ZhawoAdapter.exports.getVszhawEvents()

Function that makes api call to get next vszhaw event.

Kind: static method of ZhawoAdapter

ZhawoAdapter.exports.handleError(err, url)

Function used output errors of api calls

Kind: static method of ZhawoAdapter

Param Type
err *
url string

getVszhawFeed()

Function that makes api call to get vszhaw feed

Kind: global function

⚠️ **GitHub.com Fallback** ⚠️