Message from JavaScript talks

July 2017

— Hm, I found a bug as I fixed that up

— 

If the cache has a template that was fetched via XHR, it neglects to return a Promise, even though loadTemplateXhr should always return a Promise

— Tree-shaking

— Is the process of removing branches

— Ohhh man this is confusing, too many branches

— Don't have cached doc: -> Is it a file?
Y: Get via XHR, return the XHR Promise resolved to inserted templates.
N: Get via DOM, return inserted templates.

Do have cached doc: -> Is it a file?
Y: Return a new (non XHR) Promise resolved to inserted templates.
N: Return inserted templates.

Message permanent page

— So far that's 4 branches which all look completely different

— Why do you need a promise for cached doc?

— Well, it's the expected behavior of loadTemplateXhr and loadTemplateAsync

— I see

— So whether or not it's cached shouldn't change the return value

— Promise.resolve(<value-or-promise>) returns a promise