Explorar o código

New namespace Stats

@soyjavi %!s(int64=14) %!d(string=hai) anos
pai
achega
484fb504f2
Modificáronse 3 ficheiros con 42 adicións e 74 borrados
  1. 0 72
      src/Lungo.Environment.js
  2. 41 0
      src/boot/Lungo.Boot.Stats.js
  3. 1 2
      src/boot/Lungo.Boot.js

+ 0 - 72
src/Lungo.Environment.js

@@ -1,72 +0,0 @@
-/**
- * Set environment (Desktop or Mobile) automatically, depending on the
- * environment the subscribed events wil be different.
- *
- * @namespace LUNGO
- * @class Environment
- *
- * @author Javier Jimenez Villar <javi@tapquo.com> || @soyjavi
- * @author Guillermo Pascual <pasku@tapquo.com> || @pasku1
- */
-
-LUNGO.Environment = (function(lng, undefined) {
-
-    var MOBILE_ENVIRONMENT  = 'mobile';
-    var DESKTOP_ENVIRONMENT = 'desktop';
-
-    var _environment = DESKTOP_ENVIRONMENT;
-
-    /**
-     * Analizing if it's run in Mobile Phone and changing the type of event to subscribe.
-     *
-     * @method start
-     */
-    var start = function() {
-        if (lng.Core.isMobile()) {
-            _environment = MOBILE_ENVIRONMENT;
-            _saveStatsInLungoJS();
-        }
-    };
-
-    /**
-     * Gets the current environment for LungoJS
-     *
-     * @method current
-     *
-     * @return {String} Current environment enumerator
-     */
-    var current = function() {
-        return _environment;
-    };
-
-    /**
-     * Returns whether the development environment is in desktop mode
-     *
-     * @method isDesktop
-     *
-     * @return {Boolean} True if is in DESKTOP_ENVIRONMENT
-     */
-    var isDesktop = function() {
-        return (_environment === DESKTOP_ENVIRONMENT) ? true : false;
-    };
-
-    /**
-     * Save in LungoJS.com the use of the service for further ranking
-     *
-     * @method _saveStatsInLungoJS
-     */
-    var _saveStatsInLungoJS = function() {
-        lng.Service.post( 'http://www.lungojs.com/stats/', {
-            name: lng.App.get('name'),
-            version: lng.App.get('version'),
-            icon: lng.App.get('icon')
-        });
-    };
-
-    return {
-        start: start,
-        current: current,
-        isDesktop: isDesktop
-    };
-
-})(LUNGO);

+ 41 - 0
src/boot/Lungo.Boot.Stats.js

@@ -0,0 +1,41 @@
+/**
+ * Save in LungoJS.com the use of the service for further ranking
+ *
+ * @namespace LUNGO.Boot
+ * @class Stats
+ *
+ * @author Javier Jimenez Villar <javi@tapquo.com> || @soyjavi
+ * @author Guillermo Pascual <pasku@tapquo.com> || @pasku1
+ */
+
+LUNGO.Boot.Stats = (function(lng, undefined) {
+
+    /**
+     * Analizing if it's run in Mobile Phone and changing the type of event to subscribe.
+     *
+     * @method start
+     */
+    var start = function() {
+        if (lng.Core.isMobile()) {
+            _saveStats();
+        }
+    };
+
+    /**
+     * Save in LungoJS.com the use of the service for further ranking
+     *
+     * @method _saveStatsInLungoJS
+     */
+    var _saveStats = function() {
+        lng.Service.post( 'http://www.lungojs.com/stats/', {
+            name: lng.App.get('name'),
+            version: lng.App.get('version'),
+            icon: lng.App.get('icon')
+        });
+    };
+
+    return {
+        start: start
+    };
+
+})(LUNGO);

+ 1 - 2
src/boot/Lungo.Boot.js

@@ -11,8 +11,7 @@
 LUNGO.Boot = (function(lng, undefined) {
 
     return function() {
-        lng.Environment.start();
-
+        lng.Boot.Stats.start();
         lng.Boot.Layout.start();
         lng.Boot.Events.start();
         lng.Boot.Data.start();