This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //array of async resources to be loaded | |
| var paths = ['file1.xml', 'file2.xml', 'file3.xml']; | |
| //the callback for the ajax call | |
| var callback = function(fileIndex){ | |
| alert('this is a callback for file ' + paths[fileIndex]); | |
| }; | |
| //generates ajax calls | |
| for(var i=0; i<=paths.length; i++){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * A little workaround to proper handle resume and paused events on Android | |
| */ | |
| var platformTools = require('bencoding.android.tools').createPlatform(); | |
| var wasInForeGround = true; | |
| //to be executed on every activity staus change | |
| //check if it's passing from foreground to background or viceversa | |
| function checkStatusSwitch() { | |
| var isInForeground = platformTools.isInForeground(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @commonFunctionalityX | |
| @commonFunctionalityY | |
| @commonFunctionalityZ | |
| function myProcedure(arg1, arg2){ | |
| //procedure-specific code | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var myProcedure = commonFunctionalityX(commonFunctionalityY(commonFunctionalityZ(function(arg1, arg2){ | |
| //procedure-specific code | |
| }))); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function commonFunctionalityX(fn){ | |
| return function retX() { //function name for didactical purpose only | |
| // | |
| // Here you write the commonFunctionalityX-specific code | |
| // | |
| var args = Array.prototype.slice.call(arguments); | |
| return fn && fn.apply(this, args); | |
| }; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //navigation.js - centralized app navigation methods | |
| exports.openHomePage = function(){ /* code for opening the Home page */ }; | |
| exports.openProfilePage = function(){ /* code for opening the Profile page */ }; | |
| exports.openDashboardPage = function(){ /* code for opening Dashboard page */ }; | |
| exports.openInsightsPage = function(){ /* code for opening Insights page */ }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //navigation.js - centralized app navigation methods | |
| exports.openHomePage = function(){ /* code for opening the Home page */ }; | |
| @isLoggedIn | |
| exports.openProfilePage = function(){ /* code for opening the Profile page */ }; | |
| @isLoggedIn | |
| exports.openDashboardPage = function(){ /* code for opening Dashboard page */ }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //navigation.js - centralized app navigation methods | |
| function isLoggedIn(fn){ | |
| return function() { | |
| if( /* test if the user is logged in */ ){ | |
| /* redirect to login page */ | |
| } else { | |
| var args = Array.prototype.slice.call(arguments); | |
| return fn && fn.apply(this, args); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <VirtualHost *:80> | |
| ProxyPreserveHost On | |
| ServerName mysite.com | |
| <Location /> | |
| ProxyPass http://0.0.0.0:3000/ | |
| ProxyPassReverse http://0.0.0.0:3000/ | |
| RequestHeader set Connection "" | |
| </Location> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function compile() { | |
| clean() | |
| ensureDirectory('./dist') | |
| compileCSS() | |
| compileHTML() | |
| compileAssets() | |
| } |