{"action":"opened","issue":{"url":"https://api.github.com/repos/cseduardorangel/TVMLApp/issues/1","labels_url":"https://api.github.com/repos/cseduardorangel/TVMLApp/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/cseduardorangel/TVMLApp/issues/1/comments","events_url":"https://api.github.com/repos/cseduardorangel/TVMLApp/issues/1/events","html_url":"https://github.com/cseduardorangel/TVMLApp/issues/1","id":110947404,"number":1,"title":"Question: Templates format TVML or JS","user":{"login":"loretoparisi","id":163333,"avatar_url":"https://avatars.githubusercontent.com/u/163333?v=3","gravatar_id":"","url":"https://api.github.com/users/loretoparisi","html_url":"https://github.com/loretoparisi","followers_url":"https://api.github.com/users/loretoparisi/followers","following_url":"https://api.github.com/users/loretoparisi/following{/other_user}","gists_url":"https://api.github.com/users/loretoparisi/gists{/gist_id}","starred_url":"https://api.github.com/users/loretoparisi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loretoparisi/subscriptions","organizations_url":"https://api.github.com/users/loretoparisi/orgs","repos_url":"https://api.github.com/users/loretoparisi/repos","events_url":"https://api.github.com/users/loretoparisi/events{/privacy}","received_events_url":"https://api.github.com/users/loretoparisi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-12T10:21:47Z","updated_at":"2015-10-12T10:21:47Z","closed_at":null,"body":"I've seen that this project is using a javascript template var that loads a xml template with a js ```eval``` like or ```function``` call. And that's very cool :+1: \r\nThe question is. Is there any advantage in loading templates in this way rather than having a generic loading like let's say\r\n\r\n```javascript\r\n    /*\r\n     get document contents from url with callback\r\n     params : url\r\n     return : template XHR\r\n     */\r\n    function getDocumentContents(url, loadCallback) {\r\n        var templateXHR = new XMLHttpRequest();\r\n        templateXHR.responseType = \"document\";\r\n        templateXHR.addEventListener(\"load\", function() { loadCallback(templateXHR) }, false);\r\n        templateXHR.open(\"GET\", url, true);\r\n        templateXHR.send();\r\n        return templateXHR;\r\n    }\r\n```\r\n\r\nand then\r\n\r\n```javascript\r\nvar myDocument = getDocumentContents(path, function(xhr) {\r\n                                                      navigationDocument.dismissModal();\r\n                                                      navigationDocument.pushDocument( xhr.responseXML );\r\n                                                    })\r\n              });\r\n```"}}