<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Getting-starteds on Featherₜₛ</title>
    <link>//www.feather-ts.com/getting-started/index.xml</link>
    <description>Recent content in Getting-starteds on Featherₜₛ</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Fri, 30 Sep 2016 21:07:13 +0100</lastBuildDate>
    <atom:link href="//www.feather-ts.com/getting-started/index.xml" rel="self" type="application/rss+xml" />
    
    <item>
      <title>Getting started</title>
      <link>//www.feather-ts.com/getting-started/</link>
      <pubDate>Fri, 30 Sep 2016 21:07:13 +0100</pubDate>
      
      <guid>//www.feather-ts.com/getting-started/</guid>
      <description>

&lt;h2 id=&#34;installing-featherₜₛ&#34;&gt;Installing Featherₜₛ&lt;/h2&gt;

&lt;p&gt;Installing &lt;a href=&#34;https://github.com/Microsoft/TypeScript&#34;&gt;typescript&lt;/a&gt; and &lt;a href=&#34;https://github.com/typings/typings&#34;&gt;typings&lt;/a&gt; globally is recommended, if not yet present. Then run the following commands to add featherₜₛ as a
local dependency.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;npm install feather-ts --save
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Create a &lt;strong&gt;tsconfig.json&lt;/strong&gt; file in your project&amp;rsquo;s root containing the following settings. ES6 output is currently not supported and
since decorators are the beef of it all make sure they are enabled. Feather.js embeds the typescript emitted helpers so you can disable
them if you wish.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{
  &amp;quot;compilerOptions&amp;quot;: {
    ...
	&amp;quot;target&amp;quot;: &amp;quot;es5&amp;quot;, 
	&amp;quot;experimentalDecorators&amp;quot;: true, 
	...
  },
  &amp;quot;files&amp;quot;: [
	&amp;lt;your-source-files&amp;gt;
  ],
  &amp;quot;exclude&amp;quot;: [
    ...
	&amp;quot;node_modules&amp;quot;,
	&amp;quot;typings&amp;quot;
	...
  ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then write your widgets and include the output together with feather.js (from node_modules) in your page.
After the DOM and the scripts have been loaded make the following call; it will bootstrap the widgets and route listeners.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;feather.start();
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;a-widget-s-anatomy&#34;&gt;A widget&amp;rsquo;s anatomy&lt;/h2&gt;

&lt;p&gt;To get an impression of the code style you will be dealing with, here is a sample widget code. As you can see the code is
very compact and flat.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;module todomvc.feather {

    import Widget          = feather.core.Widget /* imports of referenced components */
    ...
    
    @Construct({selector: &#39;.todoapp&#39;}) /* the selector to bind this widget to */
    class TodoList extends Widget {    /* all widgets must extend Widget */

        @Bind() state = ListState.ALL  /* prefix members that auto update DOM with @Bind(), supported are booleans, strings and numbers */

        @Bind({templateName: &#39;default&#39;, changeOn: [&#39;state&#39;]}) /* arrays are a special case, more about the params later */
        todos: Todo[] = []
        
        /* no constructor is required */

        init(element: HTMLElement) {   /* whenever a widget is fully initialized it calls init() */
            this.getData()
        }
        
        @Fetch(&#39;/api/todos&#39;)           /* fetch data from a REST api and render the widget */
        getData(data?: Todo[]) {
            this.todos.push.apply(this.todos, data)
            this.render(&#39;default&#39;)     /* if you&#39;re not loading data you can render() already in init() */
        }

        @Subscribe(&#39;create-todo&#39;)      /* listen to messages from parent or child widgets via @Subscribe */
        newTodo(todo: Todo) {
            this.todos.push(todo)
        }

        @Route(&#39;/:path&#39;)               /* listen to route changes with @Route */
        locationPath(params: SimpleMap) {
            if (params[&#39;path&#39;] === &#39;active&#39;) {
                ...
            }
        }

        @On({event: &#39;click&#39;, selector: &#39;.clear-completed&#39;, preventDefault: true}) /* attach DOM events via @On */
        clearCompleted() {
            ...
        }

        @Template(&#39;default&#39;) /* widgets can be rendered with different templates */
        toHtml() { /* use ES6 template strings to define HTML snippets */
            return (`
              ...
              &amp;lt;ul class=&amp;quot;todo-list&amp;quot; {{todos:listFilter}}&amp;gt;&amp;lt;/ul&amp;gt;
              &amp;lt;button class=&amp;quot;clear-completed&amp;quot; hidden=&amp;quot;{{todos:noCompleted}}&amp;quot;&amp;gt;Clear completed&amp;lt;/button&amp;gt;
              ...
            `)
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;See the full todo app in action &lt;a href=&#34;http://todo.feather-ts.com/&#34;&gt;here&lt;/a&gt;. Take a peek at the typescript source maps, too.&lt;/p&gt;

&lt;div class=&#34;admonition note&#34;&gt;
&lt;p class=&#34;admonition-title&#34;&gt;Note&lt;/p&gt;
&lt;p&gt;The bindings in the HTML code are very simple. The only extra syntax on top of regular HTML is {{variable:methodA:methodB}}. Methods
are optional however they can convert values to other types, ie boolean to &amp;ldquo;yes&amp;rdquo; / &amp;ldquo;no&amp;rdquo; strings, or filter arrays before rendering.&lt;/p&gt;

&lt;p&gt;The above code is stripped off large parts, so don&amp;rsquo;t expect it to compile or run.&lt;/p&gt;
&lt;/div&gt;
</description>
    </item>
    
  </channel>
</rss>