On Github zwacky / tvml-intro
Simon Wicki (Twitter @zwacky)
Front-end guy at JustWatch.com
Twitter: @zwacky
Quick Intro to tvOS
Quick Intro to tvOS
and how they look like
XML Style
<document>
<alerttemplate>
<title>Update Available</title>
<description>Get the latest tvOS version</description>
<button>
<text>Update Now</text>
</button>
<button>
<text>Cancel</text>
</button>
</alerttemplate>
</document>
turns into...
more complex templates are possible too...
Architecture
vanilla API requests
function requestApi(url, method, body, cb) {
var xhr = new XMLHttpRequest();
xhr.responseType = 'json';
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
cb(xhr.response);
}
};
xhr.open(method, url);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.setRequestHeader("Accept", 'application/json, */*');
xhr.send(body);
}
forEaching template
<shelf>
<sectionn>
${this.cache.popular.items.map(function(title) {
return `<lockup>
<img src="${title.full_poster}" width="308" height="462">
<title class="showTextOnHighlight">${title.title.replace('&', 'and')}</title>
</lockup>`;
})}
</sectionn>
</shelf>
No.