Skip to content

Instantly share code, notes, and snippets.

@kwhinnery
Created October 31, 2011 17:20
Show Gist options
  • Select an option

  • Save kwhinnery/1328057 to your computer and use it in GitHub Desktop.

Select an option

Save kwhinnery/1328057 to your computer and use it in GitHub Desktop.

Revisions

  1. kwhinnery revised this gist Oct 31, 2011. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions app.commonjs.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    //CommonJS style
    var mod = require('browser.ti.module');
    mod.sayHello('Kevin');
  2. kwhinnery revised this gist Oct 31, 2011. 2 changed files with 12 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions app.tiinclude.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    //Ti.include style
    Ti.include('browser.ti.module.js');
    globalNamespace.sayHello('Kevin');
    9 changes: 9 additions & 0 deletions index.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    <html>
    <head>
    <script src="browser.ti.module.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript" charset="utf-8">
    //browser style
    globalNamespace.sayHello('Kevin');
    </script>
    </head>
    </html>
  3. kwhinnery revised this gist Oct 31, 2011. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion browser.ti.module.js
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    //This variable will be the public interface of the module in a script tag or Ti.include
    //This variable will be the public interface
    //of the module in a script tag or Ti.include
    var globalNamespace = {};
    (function (exports) {
    exports.sayHello = function(str) {
  4. kwhinnery created this gist Oct 31, 2011.
    7 changes: 7 additions & 0 deletions browser.ti.module.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    //This variable will be the public interface of the module in a script tag or Ti.include
    var globalNamespace = {};
    (function (exports) {
    exports.sayHello = function(str) {
    alert('Hello '+str+'!');
    };
    }(typeof exports === 'object' && exports || globalNamespace));