<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>WinJS.NamespacePage.define</Title>
      <Shortcut>wne</Shortcut>
      <Description>Define a new WinJS namespace with page events</Description>
      <Author>Jeremie Corpinot</Author>
      <SnippetTypes>
        <!-- snippet types -->
        <SnippetType>Expansion</SnippetType>
      </SnippetTypes>
    </Header>
    <Snippet>
      <Declarations>
        <Literal>
          <ID>namespace</ID>
          <ToolTip>Namespace's name</ToolTip>
          <Default>namespace</Default>
        </Literal>
        <Literal>
          <ID>body1</ID>
          <ToolTip>Function's body</ToolTip>
          <Default>// body1</Default>
        </Literal>
        <Literal>
          <ID>path</ID>
          <ToolTip>Page's location path</ToolTip>
          <Default>'path'</Default>
        </Literal>
      </Declarations>
      <Code Language="javascript">
        <![CDATA[WinJS.Namespace.define("$namespace$", {
        $body1$
        });
        
        (function () {
            "use strict";
            
            WinJS.UI.Pages.define("$path$", {
                ready: function (element, options) {
                    // TODO: Called when the page is loaded
                },
                
                unload: function () {
                    // TODO: Fired when we navigate outside this page
                },

                updateLayout: function (element) {
                    // TODO: Must be fired when the layout changes
                }
            });
        
        })();$end$
        
        ]]>
      </Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>