You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ti...@apache.org on 2012/08/16 00:25:51 UTC

[1/3] js commit: [CB-1233] - first step in getting file transfer working on playbook

Updated Branches:
  refs/heads/master b4c5682f7 -> 03f21d410


[CB-1233] - first step in getting file transfer working on playbook


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/d59fe9a4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/d59fe9a4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/d59fe9a4

Branch: refs/heads/master
Commit: d59fe9a45f28dfbfed601045a169998ccb0ba00a
Parents: b4c5682
Author: Tim Kim <ti...@nitobi.com>
Authored: Tue Aug 14 15:28:39 2012 -0700
Committer: Tim Kim <ti...@nitobi.com>
Committed: Wed Aug 15 15:24:57 2012 -0700

----------------------------------------------------------------------
 lib/playbook/plugin/manager.js             |    3 ++-
 lib/playbook/plugin/playbook/FileWriter.js |   16 ++++++++--------
 2 files changed, 10 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/d59fe9a4/lib/playbook/plugin/manager.js
----------------------------------------------------------------------
diff --git a/lib/playbook/plugin/manager.js b/lib/playbook/plugin/manager.js
index 8140162..0e07b0f 100644
--- a/lib/playbook/plugin/manager.js
+++ b/lib/playbook/plugin/manager.js
@@ -8,7 +8,8 @@ var cordova = require('cordova'),
         'Capture' : require('cordova/plugin/playbook/capture'),
         'Accelerometer' : require('cordova/plugin/playbook/accelerometer'),
         'NetworkStatus' : require('cordova/plugin/playbook/network'),
-        'Notification' : require('cordova/plugin/playbook/notification')
+        'Notification' : require('cordova/plugin/playbook/notification'),
+        'FileTransfer' : require('cordova/plugin/playbook/FileTransfer')
     };
 
 module.exports = {

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/d59fe9a4/lib/playbook/plugin/playbook/FileWriter.js
----------------------------------------------------------------------
diff --git a/lib/playbook/plugin/playbook/FileWriter.js b/lib/playbook/plugin/playbook/FileWriter.js
index e918806..a8cf4f8 100644
--- a/lib/playbook/plugin/playbook/FileWriter.js
+++ b/lib/playbook/plugin/playbook/FileWriter.js
@@ -83,10 +83,6 @@ FileWriter.prototype.write = function(text) {
         me.onwritestart(new ProgressEvent("writestart", {"target":me}));
     }
 
-    if (typeof me.onwrite === "function") {
-        me.onwrite(new ProgressEvent("write", {"target":me}));
-    }
-
     var textBlob = blackberry.utils.stringToBlob(text);
 
     if(blackberry.io.file.exists(this.fileName)){
@@ -117,6 +113,10 @@ FileWriter.prototype.write = function(text) {
 
             me.position = newText.length;
             me.length = me.position;
+            
+            if (typeof me.onwrite === "function") {
+                me.onwrite(new ProgressEvent("write", {"target":me}));
+            }
         };
 
         // setting asynch to off
@@ -193,10 +193,6 @@ FileWriter.prototype.truncate = function(size) {
         me.onwritestart(new ProgressEvent("writestart", {"target":this}));
     }
 
-    if (typeof me.onwrite === "function") {
-        me.onwrite(new ProgressEvent("write", {"target":me}));
-    }
-
     if(blackberry.io.file.exists(this.fileName)){
 
         var oldText = '';
@@ -227,6 +223,10 @@ FileWriter.prototype.truncate = function(size) {
 
             me.position = newText.length;
             me.length = me.position;
+
+            if (typeof me.onwrite === "function") {
+                 me.onwrite(new ProgressEvent("write", {"target":me}));
+            }
         };
 
         // setting asynch to off - worry about making this all callbacks later