Skip to content

Commit

Permalink
Nope
Browse files Browse the repository at this point in the history
  • Loading branch information
stephband committed Jan 10, 2024
1 parent 96b8b6a commit 6ce19c4
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions module.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,15 @@

import TemplateRenderer, { cache } from './modules/renderer-template.js';

export default function Literal(id) {
// TODO: I don't think this works, it replaces whatever template is in the
// DOM, it it probably isn't in the DOM if it's cached?
export default function Literal(template) {
// TODO: I don't think this works for accessign existing literal-html renderers,
// which is what we want to do. Instead it creates a new renderer...

const id = typeof id === 'object' ?
id.id || '' :
id ;
template = typeof template === 'string' ?
document.getElementById(template) :
template ;

if (cache[id]) {
return cache[id].create();
}

const template = typeof id === 'object' ?
id :
document.getElementById(id) ;

return new TemplateRenderer(template) ;
return new TemplateRenderer(template);
}

// TODO: Legacy, remove
Expand Down

0 comments on commit 6ce19c4

Please sign in to comment.