diff --git a/dist/js/main.js b/dist/js/main.js index 847739c..d81b4d8 100644 --- a/dist/js/main.js +++ b/dist/js/main.js @@ -1,8 +1,30 @@ "use strict"; +// Helper function for manipulating the DOM / creating DOM elements function em(tag, values, child) { let element = document.createElement(tag); + + // Can either be a "append"-able type, or properties + // If it's properties, then child must be set + if ((typeof values === 'string' || + typeof values === 'number' || + values instanceof HTMLElement) && !child) + { + element.append(element); + } + else if (typeof values === 'object' && child) { + for (const prop in values) + { + element[prop] = values[prop]; + } + } // ??? + + // Type doesn't matter, just append whatever is in child + if (child) + { + element.append(child); + } return element; } diff --git a/src/base_page.c b/src/base_page.c index 30f0476..878c5ae 100644 --- a/src/base_page.c +++ b/src/base_page.c @@ -97,7 +97,6 @@ void render_base_page(struct base_page* page, FCGX_Request* req, struct session* void send_result(FCGX_Request* req, char* status, char* content_type, char* data, size_t data_len) { - static pthread_mutex_t print_mutex = PTHREAD_MUTEX_INITIALIZER; if (data_len == 0) data_len = strlen(data); #ifdef SINGLE_THREADED printf(