Commits

Matthew Schinckel  committed d8d0e0c

Change some variable names and scope.

  • Participants
  • Parent commits fe9838c

Comments (0)

Files changed (2)

File contrib/knockout.garmin.js

   
   this.readActivities = plugin.readActivities;
   
+  this.writeWorkouts = plugin.writeWorkouts;
+  
   // Remove after debugging.
   this._plugin = plugin;
 };

File src/garmin.js

     }
     
     var plugin;
-  
+    
     // Inject the plugin into the page if it isn't already there.
     if (window.ActiveXObject) {
       // IE
   Garmin.Communicator = function Communicator(options) {
     options = options || {};
     
+    var plugin = Garmin.Plugin();
+    
     // This should be a singleton.
     if (arguments.callee._singletonInstance) {
       // We have already been executed. If we are not yet unlocked, then look for
     // We need to have a flag so we can't try to have two things happening at once.
     var inUse = false;
     var currentDevice = null;
-    var plugin = Garmin.Plugin();
     var $plugin = $(plugin);
     var unlockCodes = [
       "file:///","cb1492ae040612408d87cc53e3f7ff3c",
         var status = plugin['Finish' + readWrite + pluginMethod]();
         switch (status) {
           case Garmin.STATUS.working:
-            console.log("working");
             if (progress) {
               progress(getProgress());
             };
 
     // simple interface to reading FIT or TCX files, switching of base methods
     // performed according to current device support
-    this.readFile = function (file_id, callback) {
+    this.readFile = function (fileName, callback) {
       if (this.activeDevice().canReadFITActivities()) {
-        var data = plugin.GetBinaryFile(currentDevice, file_id, false);
+        var data = plugin.GetBinaryFile(currentDevice, fileName, false);
         var binary_data = decodeBinaryFile(data);
         if (callback) {
           callback(binary_data);
         }
       } else {
-        readHandler('FitnessHistory', 'FitnessDetail', 'FitnessHistory', file_id)(callback);
+        readHandler('FitnessHistory', 'FitnessDetail', 'FitnessHistory', fileName)(callback);
       }
     }
 
-    decodeBinaryFile = function (input) {
+    var decodeBinaryFile = function (input) {
       var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
       var output = [];
       var chr1, chr2, chr3 = 0;