Skip to content

WFES Base version 2 public functions

AlterTobi edited this page Dec 11, 2024 · 3 revisions

public functions

all functions are prefixed by window.wfes.f

addCSS(id, styles)

Add CSS-Element to document's head section as long it does not yet exist.

param description
id id for HTML style tag
styles text containing the CSS

localSave(name, content) - Promise

Save content as name in IndexedDB in a localStorage compatible way (name-value-pairs)

localGet(name, content="") - Promise

  • get saved data from IndexedDB in a localStorage compatible way (name-value-pairs)
  • if data not exists in IDB, try to get it from localStorage and move it to IDB
  • return content if nothing exists

localStorageSave = (name, content) - Promise

Save content as name in localStorage

localStorageGet(name, content="") - Promise

get saved data from localStorage, or content if nothing exists

sessionGet(name, content="") - Promise

get saved data from sessionStorage, or content if nothing exists

sessionSave(name, content) - Promise

Save content as name in sessionStorage

makeIDbasedDictionary(itemlist)

return id based dict from itemlist

createNotification(msg[, color], [callbackConfig])

create a notification message in lower right corner

param type Version description
msg string 2.0 the message string
color string, optional 2.0 background color, must be one of "red", "blue", "orange", "fuchsia", "green", default is "green"
callbackConfig object, optional 2.3 optional callback funktion with parameters, see below

Since Base 2.3 it's possible to have an optional callback. Notification will display a button

callbackConfig {
  callback: Function  : required - the function to call
  params: Array : optional - parameters for the callback function
  icon: String : optional - one of "play", "search", "renew", 
}

(more icons added on request, must be from material font)

hasMinVersion(minversion)

returns true if version of wfes-Base is greater or equal minversion

waitForElem(selector, maxWaitTime = 5000) - Promise

wait until a DOM element appears

param type description
selector string the query selector of the element
maxWaitTime integer, optional max time to wait for element in ms, default = 5 seconds