Message from JavaScript discussions
July 2017
—
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);
}
Heavy use of this thunk in 5 different places, so it seems like a good candidate to insert this logic
— Is that a 1 or an L?
— TemplDoc
— L, I see
— Stands for "template document", a DocumentFragment
— Hyper speed, good for templating
— If conf.paged
is true
, then what the ssystem should do is insert multiple templates into the destination node, using an array to populate them like this:
[
{prop: "hello world"},
{prop: "hello sunshine"},
{prop: "hello baby"},
{prop: "hello sweetie"},
]
— So if conf.elemPerPage
is set to 4, then we get 4 templates filled out in that order, with template 2 having "hello sunshine" etc...
— Normally, without conf.paged
, you just give the loader a single object like one of those
— I see
— Go larger