Message from JavaScript discussions

July 2017

— Well I figured my problem out, but now I see I need a huge algorithm refactor


Where a single template has a single data source, if you pass an array containing data source objects, then each one can be injected into a seperate template, making the paging system a loop which makes elemPerPage number of clones and inserts them

— Right now my algorithm to do that is... not really capable of doing that

— Uhhhh

— ¯\_(ツ)_/¯


function insertionThunk (templDoc) {
if (conf.paged) {
var templDocs = [];
for (var loc = 0; loc <= conf.elemPerPage; loc++) {
templDocs[templDocs.length] = newFragmentClone(templDoc);
} else {
var templDocs = [templDoc];
return insertTemplate(injectData(templDocs, conf), destElems, conf);

Message permanent page

— Heavy use of this thunk in 5 different places, so it seems like a good candidate to insert this logic

Message permanent page

— Is that a 1 or an L?

— TemplDoc

— L, I see

— Stands for "template document", a DocumentFragment

— Hyper speed, good for templating