Uploaded image for project: 'Alloy'
  1. Alloy
  2. ALOY-780

Support DEBUG compiler constant

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: Alloy 2.0.0
    • Component/s: Runtime, Tooling
    • Labels:
      None

      Description

      Add DEBUG as a compiler conditional, like OS_ANDROID or ENV_TEST. This should be false by default and configurable through the config.json. This should be used for logging or other operations that you want to be able to see regardless of deploy type, but only when debugging.

      config.json

      {
        "DEBUG": true
      }
      

      index.js

      // assuming we have a "collection" with lots of models...
       
      for (var i = 0; i < collection.length; i+) {
          var model = collection.at(i);
       
          // perform critical operation
       
          // If DEBUG=true, leave this in the code. If it is false, remove this at compile time.
          // Good for things like logging or other expensive, non-essential debugging operations.
          if (DEBUG) {
              Ti.API.info(JSON.stringify(model.attributes, null, '  '));
          }
      }
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              tlukasavage Tony Lukasavage
            • Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Integration