<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://devlicio.us/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>.NET &amp; Funky Fresh : JavaScript</title><link>http://devlicio.us/blogs/rob_eisenberg/archive/tags/JavaScript/default.aspx</link><description>Tags: JavaScript</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP1 (Build: 31106.3070)</generator><item><title>Durandal 1.2.0 and Caliburn.Micro 1.5.0 Released!</title><link>http://devlicio.us/blogs/rob_eisenberg/archive/2013/03/18/durandal-1-2-0-and-caliburn-micro-1-5-0-released.aspx</link><pubDate>Tue, 19 Mar 2013 00:10:59 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:102953</guid><dc:creator>Rob Eisenberg</dc:creator><slash:comments>8</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/rob_eisenberg/rsscomments.aspx?PostID=102953</wfw:commentRss><comments>http://devlicio.us/blogs/rob_eisenberg/archive/2013/03/18/durandal-1-2-0-and-caliburn-micro-1-5-0-released.aspx#comments</comments><description>&lt;p&gt;Two awesome releases in the last week! Much thanks to the great community surrounding both projects! Here’s what’s new:&lt;/p&gt;  &lt;h3&gt;Durandal 1.2.0&lt;/h3&gt;  &lt;ul&gt;   &lt;li&gt;Tons of bug fixes.&lt;/li&gt;    &lt;li&gt;Lots of improvements to the router.&lt;/li&gt;    &lt;li&gt;Better support for integrating with Q, KendoUI and Dojo.&lt;/li&gt;    &lt;li&gt;More docs.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="https://github.com/BlueSpire/Durandal/blob/master/Changes.txt" target="_blank"&gt;Check out the full set of changes.&lt;/a&gt;&lt;/p&gt;  &lt;h3&gt;Caliburn.Micro. 1.5.0&lt;/h3&gt;  &lt;p&gt;Nigel Sampson and Thomas Ibel are going to town these days! Some really cool stuff happening in this release. Here’s a few things:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Task and Async support (on all platforms except SL4 and WP71)&lt;/li&gt;    &lt;li&gt;Task/Coroutine integration.&lt;/li&gt;    &lt;li&gt;Actions can return tasks.&lt;/li&gt;    &lt;li&gt;More async stuff in general.&lt;/li&gt;    &lt;li&gt;Support for the WinRT Share Charm&lt;/li&gt;    &lt;li&gt;Support for the WinRT Settings Charm&lt;/li&gt;    &lt;li&gt;Various bug fixes and minor improvements throughout.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;You can get the latest versions of both of these frameworks on Nuget.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=102953" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/WPF/default.aspx">WPF</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Xaml/default.aspx">Xaml</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/WPF_2F00_e/default.aspx">WPF/e</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Caliburn/default.aspx">Caliburn</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/RIA/default.aspx">RIA</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/MVVM/default.aspx">MVVM</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/UI+Architecture/default.aspx">UI Architecture</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Caliburn+Micro/default.aspx">Caliburn Micro</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/WP7/default.aspx">WP7</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/NuGet/default.aspx">NuGet</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/JavaScript/default.aspx">JavaScript</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Durandal/default.aspx">Durandal</category></item><item><title>Introducing TypeScript</title><link>http://devlicio.us/blogs/rob_eisenberg/archive/2012/10/02/introducing-typescript.aspx</link><pubDate>Tue, 02 Oct 2012 15:46:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:70357</guid><dc:creator>Rob Eisenberg</dc:creator><slash:comments>13</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/rob_eisenberg/rsscomments.aspx?PostID=70357</wfw:commentRss><comments>http://devlicio.us/blogs/rob_eisenberg/archive/2012/10/02/introducing-typescript.aspx#comments</comments><description>&lt;p&gt;This is the first tech coming out of Microsoft in several years that I&amp;rsquo;m excited about&amp;hellip;.really excited about. So, I thought I would take you, dear reader, on a learning adventure with me. Let&amp;rsquo;s dive in&amp;hellip;&lt;/p&gt;
&lt;h3&gt;What is TypeScript?&lt;/h3&gt;
&lt;p&gt;TypeScript is a new programming language that Microsoft has been working on, apparently, for several years now. Anders Hejlsberg, creator of C#, has recently been involved with a small team of talented language gurus to bring it to us in the initial pre-release form. &lt;/p&gt;
&lt;p&gt;Simply stated: &lt;em&gt;TypeScript is a superset of the JavaScript programming language which can be compiled to plain Javascript&lt;/em&gt;. The &lt;strong&gt;superset&lt;/strong&gt; distinction is important here. Every Javascript program is a TypeScript program and will compile with the TypeScript compiler without any alterations necessary. TypeScript works with any existing JavaScript libraries without the need for any sort of interoperability dance.&lt;/p&gt;
&lt;h3&gt;Why Use TypeScript?&lt;/h3&gt;
&lt;p&gt;TypeScript brings several of the features of ECMAScript 6th Edition to ECMAScript 3rd Edition compatible browsers and runtimes. This means you can have several of the cool features of tomorrow&amp;rsquo;s Javascript&amp;hellip;today. Some of the most notable features are classes, modules and lexically scoped this (via arrow functions). So, by learning TypeScript today, you are also going to be learning some ECMAScript 6th Edition&amp;hellip;that&amp;rsquo;s a pretty good return on your investment even if TypeScript is a complete flop&amp;hellip;.which I doubt it will be.&lt;/p&gt;
&lt;p&gt;In addition to getting vNext JS features available in present and older browsers, TypeScript adds a &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Structural_type_system"&gt;structural type system&lt;/a&gt; and strong &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Type_inference"&gt;type inference&lt;/a&gt; to JavaScript. This opens the door to declared API contracts, better intellisense, refactoring and it naturally transforms many runtime errors into &lt;em&gt;code squiggles&lt;/em&gt; or compile errors. As someone who spends 60+ hours a week now writing JS code&amp;hellip;much of which is on a very large-scale SPA&amp;hellip;I can tell you this is a big deal in terms of maintainability.&lt;/p&gt;
&lt;h3&gt;How Do I Get It?&lt;/h3&gt;
&lt;p&gt;Microsoft has two key locations on the web you need to know. The first is &lt;a href="http://www.typescriptlang.org/"&gt;http://www.typescriptlang.org/&lt;/a&gt; From there you can download the language specification, watch a Channel 9 Video with Anders introducing the language, play with the language directly from your browser and run some samples. You&amp;rsquo;ll also find download links for the VS2012 plugin and compiler tools as well as the source. WAIT. Did I just say source? YES. TypeScript is completely open source on CodePlex under the Apache License 2.0.&amp;nbsp; You can git clone that sucka to your heart&amp;rsquo;s content&amp;hellip;which brings me to the second web location you need to know: &lt;a href="http://typescript.codeplex.com/"&gt;http://typescript.codeplex.com/&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;How Do I Get Involved?&lt;/h3&gt;
&lt;p&gt;As I mentioned, TypeScript is on CodePlex. There&amp;rsquo;s a community building up there already. So you can jump into the discussion forums to ask questions&amp;hellip;or answer them with your new found knowledge :)&amp;nbsp; Naturally, you can submit bugs and feature requests too. There&amp;rsquo;s also a fair amount of info accumulating on &lt;a target="_blank" href="http://stackoverflow.com/search?q=typescript"&gt;stack overflow&lt;/a&gt; now.&lt;/p&gt;
&lt;h3&gt;Show Me How to Write a Program!!!&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a target="_blank" href="http://www.typescriptlang.org/#Download"&gt;Download the tooling&lt;/a&gt; and run the msi &lt;em&gt;or&lt;/em&gt; install it as a node package with: npm install &amp;ndash;g typescript&lt;/li&gt;
&lt;li&gt;Once this is done, you&amp;rsquo;ve got a new exe added to your command path called &amp;ldquo;tsc&amp;rdquo; You guessed it. That stands for &amp;ldquo;TypeScript Compiler.&amp;rdquo;&lt;/li&gt;
&lt;li&gt;To compile a program it&amp;rsquo;s as simple as typing this on the command prompt: tsc myCode.ts&lt;/li&gt;
&lt;li&gt;.ts is the extension for TypeScript source files. &lt;/li&gt;
&lt;li&gt;.d.ts is the extension for TypeScript declaration source files (more on that in a future post)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Let&amp;rsquo;s do it! Create a new file and call it&amp;hellip;dum dum dum&amp;hellip;.helloworld.ts. You can open it in any text editor, but if you&amp;rsquo;ve installed the VS tools above, you should open it in VS&amp;hellip;it&amp;rsquo;s got bling.&lt;/p&gt;
&lt;p&gt;Now, let&amp;rsquo;s write some code. This will be a pretty bloated hello world example, but it will show you some fun language stuff in the process. Here&amp;rsquo;s the code to put in the helloworld.ts file:&lt;/p&gt;
&lt;pre name="code" class="js:nogutter:nocontrols"&gt;module HelloWorld {
    class Messenger {
        repeat: number;

        constructor (public message = &amp;quot;Hello World&amp;quot;) {
            this.repeat = 1;
        }

        speak() {
            for (var i = 0; i &amp;lt; this.repeat; i++) {
                console.log(this.message);
            }
        }

        static SayHelloInSlang() { 
            new Messenger(&amp;quot;&amp;#39;Sup World?&amp;quot;).speak();
        }
    }

    var m = new Messenger();
    m.speak();

    Messenger.SayHelloInSlang();
}&lt;/pre&gt;
&lt;p&gt;To get the full VS experience,&amp;nbsp; you should type this in manually, rather than copy/paste. The reason for that is that VS will show you errors, types, etc. as you type the code. You&amp;rsquo;ll also get intellisense. Here&amp;rsquo;s a few things to notice about this code:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;It&amp;rsquo;s modularized! This is called an &lt;em&gt;internal&lt;/em&gt; module. You can also create &lt;em&gt;external&lt;/em&gt; modules which the compiler can transform into CommonJS modules or AMD modules (yes you can use it with require.js :) whoohoo). You can tell the compiler how to transform your external modules via the &amp;ndash;module switch. This enables you to have a single source set of modules that could run on the server in Node with CommonJS and in the browser with AMD using require.js. Nice. The &amp;ndash;module switch defaults to CommonJS, but you can provide the value of amd to build for require.js or a similar amd module loader. But, that&amp;rsquo;s not related to this code&amp;hellip;just a bonus tidbit. This is an &lt;em&gt;internal&lt;/em&gt; module which means it will compile to a standard immediately executed function closure-based module.&lt;/li&gt;
&lt;li&gt;There is a class!!! The compiler will help you call that ctor with new&amp;hellip;no more forgotten new keywords on ctor functions. But you can also more succinctly create classes than with the standard prototype-based syntax you normally need.&lt;/li&gt;
&lt;li&gt;The ctor has a default parameter value. Also, the public modifier instructs the compiler that the parameter&amp;rsquo;s value should automatically be stored into a public property of the object. Nice and succinct.&lt;/li&gt;
&lt;li&gt;There&amp;rsquo;s a static function on the class.&lt;/li&gt;
&lt;li&gt;Mouse over things and you will see that there&amp;rsquo;s some nice type inference happening on variables and function signatures&amp;hellip;even though only one type is declared anywhere.&lt;/li&gt;
&lt;li&gt;Intellisense is beautiful.&lt;/li&gt;
&lt;li&gt;Try refactoring something. It works :)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Now, let&amp;rsquo;s compile the code. Open your command prompt and navigate to the folder you placed helloworld.ts in. Type the following:&lt;/p&gt;
&lt;p&gt;tsc helloworld.ts&lt;/p&gt;
&lt;p&gt;The compiler outputs a .js file with the following JavaScript code:&lt;/p&gt;
&lt;pre name="code" class="js:nogutter:nocontrols"&gt;var HelloWorld;
(function (HelloWorld) {
    var Messenger = (function () {
        function Messenger(message) {
            if (typeof message === &amp;quot;undefined&amp;quot;) { message = &amp;quot;Hello World&amp;quot;; }
            this.message = message;
            this.repeat = 1;
        }
        Messenger.prototype.speak = function () {
            for(var i = 0; i &amp;lt; this.repeat; i++) {
                console.log(this.message);
            }
        };
        Messenger.SayHelloInSlang = function SayHelloInSlang() {
            new Messenger(&amp;quot;&amp;#39;Sup World?&amp;quot;).speak();
        }
        return Messenger;
    })();    
    var m = new Messenger();
    m.speak();
    Messenger.SayHelloInSlang();
})(HelloWorld || (HelloWorld = {}));&lt;/pre&gt;
&lt;p&gt;As you can see, it&amp;rsquo;s just standard JavaScript code. There is no runtime component to TypeScript. Everything boils down to plain JavaScript.&lt;/p&gt;
&lt;p&gt;Of course there&amp;rsquo;s lots more to TypeScript. We&amp;rsquo;ve barely scratched the surface. I&amp;rsquo;m planning to write some more blog posts covering my escapades. Hopefully we can talk more about external modules, structural types, interfaces, lambdas, etc. See ya next time!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=70357" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Featured/default.aspx">Featured</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Tutorial/default.aspx">Tutorial</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/JavaScript/default.aspx">JavaScript</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/TypeScript/default.aspx">TypeScript</category></item></channel></rss>