Retain comment when TypeScript compiles -
look @ code in typescript playground. need comments placed in result js code have ability determine browser ie according this question. cc_on
ie conditional compilation directive.
typescript
window.isbrowser = { ie: function() { return /*@cc_on!@*/false; } };
compiled javascript
window.isbrowser = { ie: function () { return false; } };
if use webessentials 2012, have option retain comments. after installing extension, in vs 2012, go tools > options > web essentials > typescript > keep comments , set value true.
your sample works fine me in vs2012 we:
window["isbrowser"] = { // presume came plugin or script? window doesn't have 'isbrowser' property. ie: function () { return /*@cc_on!@*/false; } };
compiles to:
window["isbrowser"] = { ie: function () { return /*@cc_on!@*/ false; } };
update: although recommend webessentials kinds of other reasons, can without - see @stevefenton's useful comment below.
Comments
Post a Comment