JSFiddle - React, Tailwind, and code Playground

by amindunited

JavaScript

const toRaw = (...args) => args;
const myTemplate = toRaw`This is My Template. ${'templateDescription'}. The End.`;
// Emulate API call delay
setTimeout(() => {
	const context = {
  	templateDescription: 'It came back from the server, Later'
  };
  function processStringRaw (args) {
    const strings = args.shift();
    const values = args.map(key => this[key]);
    return String.raw(strings, values);
  };
  const process = processStringRaw.bind(context);
  console.log('process...', process(myTemplate))
}, 10);