Skip to content

Instantly share code, notes, and snippets.

@MichMich
Last active September 27, 2017 16:18
Show Gist options
  • Save MichMich/2a1e97a25e91a5d9ba3670dcccff3d15 to your computer and use it in GitHub Desktop.
Save MichMich/2a1e97a25e91a5d9ba3670dcccff3d15 to your computer and use it in GitHub Desktop.

Revisions

  1. MichMich revised this gist Sep 27, 2017. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions helloworld.js
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,7 @@ Module.register("helloworld",{
    /* ... */

    getTemplate: function () {

    // Should return a String: the template filename.
    // We could also allow users to return a template string,
    // and check if the string ends with `.html` in that case
    @@ -19,9 +20,11 @@ Module.register("helloworld",{
    },

    getTemplateData: function () {

    // Should return an object.
    // If this method is not defined, the default implementation in module.js
    // should return an empty object {}

    return {name: "Michael"}
    }

  2. MichMich revised this gist Sep 27, 2017. 1 changed file with 7 additions and 5 deletions.
    12 changes: 7 additions & 5 deletions helloworld.js
    Original file line number Diff line number Diff line change
    @@ -3,16 +3,18 @@ Module.register("helloworld",{
    /* ... */

    getTemplate: function () {
    // Should return a template filename.
    // We could also allow users to return a tempalte string,
    // Should return a String: the template filename.
    // We could also allow users to return a template string,
    // and check if the string ends with `.html` in that case
    // use the file, otherwiste the literal string.
    //
    // If it returns false, we are not using templates.
    // This should be the default implementation in module.js
    // The default implementation schould be a templete string
    // containing the Modules name (for debugging), which is
    // currently the default getDom implementation.
    //
    // It this method returns a string, the template is parsed into
    // The template or templateString will be parsed into
    // a dom object and used by the default getDom implementation.

    return "helloworld.html"
    },

  3. MichMich renamed this gist Sep 27, 2017. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. MichMich created this gist Sep 27, 2017.
    26 changes: 26 additions & 0 deletions mode.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    Module.register("helloworld",{

    /* ... */

    getTemplate: function () {
    // Should return a template filename.
    // We could also allow users to return a tempalte string,
    // and check if the string ends with `.html` in that case
    // use the file, otherwiste the literal string.
    //
    // If it returns false, we are not using templates.
    // This should be the default implementation in module.js
    //
    // It this method returns a string, the template is parsed into
    // a dom object and used by the default getDom implementation.
    return "helloworld.html"
    },

    getTemplateData: function () {
    // Should return an object.
    // If this method is not defined, the default implementation in module.js
    // should return an empty object {}
    return {name: "Michael"}
    }

    }