Introduction

DokuMe provides some helper tools for easier coding. This functions are only available within DokuMe environment.

Get Dom element

Use this shorthand functions to write less code. Also it catches any errors if an element is undefiened.

el('elementId') == document.getElementById('elementId')

elq('querySelector') == document.querySelector('querySelector')

Error handling

Use this function to validate your API requests, whether there are no errors. If so they will be catched and an error notification will be displayed to the user.

util.errorHandler(data, showSuccess, callback)

eg:

if (!util.errorHandler(data)) {
    return false;
}
param type value
data JSON Object should contain { data.SUCCESS === true }
showSuccess INT null, 1 = Show save success message, 0 = Show delete success message
callback FUNCTION

System notifications

DM_TEMPLATE.showSystemNotification(type, text, callback);
param type value
type INT 1 = Success, 0 = Error
text TEXT The text as a string that should be displayed
callback FUNCTION

Loading placeholder

DM_TEMPLATE.showLoader(selector, type, size);
param type value
selector CSS QuerySelector
type INT 1 = table, 2 = div
size INT optional, use in tables the amount of cols to fit 100% of the table

Loading button

DM_TEMPLATE.showBtnLoader(btn, show);
param type value
btn html element button
show boolean true, false