You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ha...@apache.org on 2017/07/14 09:52:47 UTC

git commit: [flex-asjs] [refs/heads/develop] - Added support for JS upload progress events

Repository: flex-asjs
Updated Branches:
  refs/heads/develop b88f92e7b -> ef400cfc2


Added support for JS upload progress events


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/ef400cfc
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/ef400cfc
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/ef400cfc

Branch: refs/heads/develop
Commit: ef400cfc253279b11d9e0a62e611e0e0579fb582
Parents: b88f92e
Author: Harbs <ha...@in-tools.com>
Authored: Fri Jul 14 12:52:43 2017 +0300
Committer: Harbs <ha...@in-tools.com>
Committed: Fri Jul 14 12:52:43 2017 +0300

----------------------------------------------------------------------
 .../org/apache/flex/events/ProgressEvent.as     |  10 ++
 .../Network/src/main/flex/NetworkClasses.as     |   1 +
 .../flex/org/apache/flex/net/URLBinaryLoader.as |  48 ++------
 .../org/apache/flex/net/URLBinaryUploader.as    | 102 +++++++++++++++++
 .../main/flex/org/apache/flex/net/URLStream.as  |  52 ++++++---
 .../flex/org/apache/flex/net/URLUploadStream.as | 114 +++++++++++++++++++
 6 files changed, 278 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ef400cfc/frameworks/projects/Core/src/main/flex/org/apache/flex/events/ProgressEvent.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/events/ProgressEvent.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/events/ProgressEvent.as
index cc15416..be1606d 100644
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/events/ProgressEvent.as
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/events/ProgressEvent.as
@@ -75,6 +75,16 @@ package org.apache.flex.events
          */
 		public static const PROGRESS:String = "progress";
 
+        /**
+         *  For upload progress events.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+		public static const UPLOAD_PROGRESS:String = "uploadprogress";
+
 		/**
 		 * Create a copy/clone of the ProgressEvent object.
 		 *

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ef400cfc/frameworks/projects/Network/src/main/flex/NetworkClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Network/src/main/flex/NetworkClasses.as b/frameworks/projects/Network/src/main/flex/NetworkClasses.as
index 51482f3..c4b5177 100644
--- a/frameworks/projects/Network/src/main/flex/NetworkClasses.as
+++ b/frameworks/projects/Network/src/main/flex/NetworkClasses.as
@@ -30,6 +30,7 @@ internal class NetworkClasses
 {	
 	import org.apache.flex.net.URLBinaryLoader; URLBinaryLoader;
     import org.apache.flex.net.HTTPConstants; HTTPConstants;
+    import org.apache.flex.net.URLBinaryUploader; URLBinaryUploader;
 }
 
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ef400cfc/frameworks/projects/Network/src/main/flex/org/apache/flex/net/URLBinaryLoader.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Network/src/main/flex/org/apache/flex/net/URLBinaryLoader.as b/frameworks/projects/Network/src/main/flex/org/apache/flex/net/URLBinaryLoader.as
index 326ccbe..7d46cbc 100644
--- a/frameworks/projects/Network/src/main/flex/org/apache/flex/net/URLBinaryLoader.as
+++ b/frameworks/projects/Network/src/main/flex/org/apache/flex/net/URLBinaryLoader.as
@@ -27,7 +27,7 @@ package org.apache.flex.net
 
 
 	/**
-	 *  The BinaryUploader class is a relatively low-level class designed to get
+	 *  The URLBinaryLoader class is a relatively low-level class designed to get
 	 *  binary data over HTTP the intent is to create similar classes for text and URL vars.  
 	 *  
 	 *  @langversion 3.0
@@ -59,7 +59,7 @@ package org.apache.flex.net
 		public var endian:String = Endian.BIG_ENDIAN;
 		
 
-        private var stream:URLStream;
+        protected var stream:URLStream;
         
 		/**
 		 *  The number of bytes loaded so far.
@@ -84,13 +84,17 @@ package org.apache.flex.net
         public function URLBinaryLoader()
         {
             super();
+            createStream();
+        }
+        protected function createStream():void
+        {
             stream = new URLStream();
         }
         private function progressFunction(stream:URLStream):void
         {
             bytesLoaded = stream.bytesLoaded;
             bytesTotal = stream.bytesTotal;
-            dispatchEvent(new ProgressEvent(ProgressEvent.PROGRESS,false,false,bytesLoaded,bytesTotal));
+            dispatchEvent(new ProgressEvent("progress",false,false,bytesLoaded,bytesTotal));
             if(onProgress)
                 onProgress(this);
         }
@@ -98,14 +102,14 @@ package org.apache.flex.net
         private function statusFunction(stream:URLStream):void
         {
             requestStatus = stream.requestStatus;
-            dispatchEvent(new DetailEvent(HTTPConstants.STATUS,false,false,""+requestStatus));
+            dispatchEvent(new DetailEvent("httpStatus",false,false,""+requestStatus));
             if(onStatus)
                 onStatus(this);
         }
         
         private function errorFunction(stream:URLStream):void
         {
-            dispatchEvent(new DetailEvent(HTTPConstants.COMMUNICATION_ERROR,false,false,""+requestStatus));
+            dispatchEvent(new DetailEvent("communicationError",false,false,""+requestStatus));
             if(onError)
                 onError(this);
             cleanupCallbacks();
@@ -114,13 +118,13 @@ package org.apache.flex.net
         private function completeFunction(stream:URLStream):void
         {
 			data = stream.response;
-            dispatchEvent(new org.apache.flex.events.Event(HTTPConstants.COMPLETE));
+            dispatchEvent(new org.apache.flex.events.Event("complete"));
             if(onComplete)
                 onComplete(this);
             cleanupCallbacks();
         }
         
-        private function setupCallbacks():void
+        protected function setupCallbacks():void
         {
             stream.onProgress = progressFunction;
 
@@ -153,37 +157,9 @@ package org.apache.flex.net
         public function close():void
         {
             stream.close();
+            cleanupCallbacks();
 			//TODO do we need a callback for canceling?
         }
-        
-        private function completeHandler(event:Event):void
-        {
-            data = stream.response;
-            if (data)
-            {
-                dispatchEvent(event);
-				if(onComplete)
-					onComplete(this);
-
-            }
-            else
-            {
-                // TODO dipatch error event?
-                dispatchEvent(new Event(HTTPConstants.IO_ERROR));
-				if(onError)
-					onError(this);
-            }
-			cleanupCallbacks();
-        }
-        
-        private function progressHandler(event:ProgressEvent):void
-        {
-            this.bytesLoaded = event.current;
-            this.bytesTotal = event.total;
-            dispatchEvent(event);
-			if(onProgress)
-				onProgress(this);
-        }
     }
 }
 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ef400cfc/frameworks/projects/Network/src/main/flex/org/apache/flex/net/URLBinaryUploader.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Network/src/main/flex/org/apache/flex/net/URLBinaryUploader.as b/frameworks/projects/Network/src/main/flex/org/apache/flex/net/URLBinaryUploader.as
new file mode 100644
index 0000000..6650d38
--- /dev/null
+++ b/frameworks/projects/Network/src/main/flex/org/apache/flex/net/URLBinaryUploader.as
@@ -0,0 +1,102 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package org.apache.flex.net
+{
+
+	import org.apache.flex.events.ProgressEvent;
+	import org.apache.flex.net.URLUploadStream;
+	import org.apache.flex.net.URLBinaryUploader;
+
+	/**
+	 * @see URLBinaryLoader
+	 * The URLBinaryUploader class subclasses URLBinaryLoader to offer upload progress events.
+	 *  
+	 * This class is only used for JS implementations because Flash upload events need to be handled differently.
+	 * In Flash, URLLoader does not dispatch upload events. It only dispatches download events.
+	 * To get upload events in Flash, you need to use File/FileReference.upload() and attach event listeners to that.
+	 *
+	 * Care should be taken when using this class because it attaches a progress listener to the xhr.upload object.
+	 * Doing so causes browsers to send OPTIONS requests. This will return an unauthorized response from servers not
+	 * configured to allow CORS OPTIONS requests. See this S.O. post for details. https://stackoverflow.com/a/17057853
+	 *  
+	 * @langversion 3.0
+	 * @playerversion Flash 10.2
+	 * @playerversion AIR 2.6
+	 * @productversion FlexJS 0.9.0
+	 */
+	public class URLBinaryUploader extends URLBinaryLoader
+	{
+		public function URLBinaryUploader()
+		{
+			super();
+		}
+        override protected function createStream():void
+        {
+            stream = new URLUploadStream();
+        }
+
+		/**
+		 * @flexjsignorecoercion org.apache.flex.net.URLUploadStream
+		 */
+        override protected function setupCallbacks():void
+        {
+			super.setupCallbacks();
+			(stream as URLUploadStream).onUploadProgress = uploadProgressFunction;
+        }
+		override protected function cleanupCallbacks():void
+		{
+			super.cleanupCallbacks();
+			onUploadProgress = null;
+		}
+
+		/**
+		 *  Callback for upload progress event.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.9.0
+		 */		
+		public var onUploadProgress:Function;
+
+		/**
+		 *  Convenience function for upoad progress event to allow chaining.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.9.0
+		 */		
+		public function uploadProgress(callback:Function):URLBinaryUploader
+		{
+			onUploadProgress = callback;
+			return this;
+		}
+
+        private function uploadProgressFunction(stream:URLStream):void
+        {
+            bytesLoaded = stream.bytesLoaded;
+            bytesTotal = stream.bytesTotal;
+            dispatchEvent(new ProgressEvent("uploadprogress",false,false,bytesLoaded,bytesTotal));
+            if(onUploadProgress)
+                onUploadProgress(this);
+        }
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ef400cfc/frameworks/projects/Network/src/main/flex/org/apache/flex/net/URLStream.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Network/src/main/flex/org/apache/flex/net/URLStream.as b/frameworks/projects/Network/src/main/flex/org/apache/flex/net/URLStream.as
index 3946fa3..e1609b5 100644
--- a/frameworks/projects/Network/src/main/flex/org/apache/flex/net/URLStream.as
+++ b/frameworks/projects/Network/src/main/flex/org/apache/flex/net/URLStream.as
@@ -38,19 +38,26 @@ package org.apache.flex.net
         import flash.net.URLVariables;
         import flash.utils.ByteArray;
     }
-        
+    
+	/**
+	 * The URLStream class deals with the underlying platform-specifc architecture for HTTP Requests
+	 * It makes the request and stores the response, dispatching events.
+	 */
     public class URLStream extends EventDispatcher
     {
         COMPILE::JS 
         {
-            private var xhr:XMLHttpRequest;
+            protected var xhr:XMLHttpRequest;
         }
             
         COMPILE::SWF
         {
             private var flashUrlStream:flash.net.URLStream
         }
-            
+        
+		/**
+		 * constructor
+		 */
         public function URLStream()
         {
             super();
@@ -76,6 +83,10 @@ package org.apache.flex.net
 		 */        
 		public var bytesTotal:uint = 0;
 
+		/**
+		 * The BinaryData reponse received from the request. This can be a response or an error response.
+		 * The client should check the status to know how to interpret the response.
+		 */
         public function get response():BinaryData
         {
             COMPILE::JS
@@ -90,6 +101,13 @@ package org.apache.flex.net
 			}
         }
 
+		/**
+		 * loads the request
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.7.0
+		 */
         public function load(urlRequest:org.apache.flex.net.URLRequest):void
         {
             COMPILE::JS {
@@ -114,8 +132,7 @@ package org.apache.flex.net
             		xhr.setRequestHeader("Content-type", urlRequest.contentType);
 				}
 				var requestData:Object = urlRequest.data is BinaryData ? (urlRequest.data as BinaryData).data : HTTPUtils.encodeUrlVariables(urlRequest.data);
-				xhr.send(requestData);
-//				xhr.send(HTTPUtils.encodeUrlVariables(urlRequest.data));
+				send(requestData);
             }
             COMPILE::SWF 
             {
@@ -152,6 +169,15 @@ package org.apache.flex.net
                 flashUrlStream.load(req);
             }
         }
+		/**
+		 * send is a protected function in js so a subclass can attach an upload listener
+		 * without rewriting the whole load() function
+		 */
+		COMPILE::JS
+		protected function send(requestData:Object):void
+		{
+			xhr.send(requestData);
+		}
 
 		/**
 		 *  HTTP status changed (Flash only).
@@ -221,7 +247,7 @@ package org.apache.flex.net
         }
 
 		/**
-		 *  Upload is progressing (Flash only).
+		 *  Download is progressing (Flash only).
 		 *
 		 *  @langversion 3.0
 		 *  @playerversion Flash 10.2
@@ -241,7 +267,7 @@ package org.apache.flex.net
         }
 
 		/**
-		 *  Upload is progressing (JS only).
+		 *  Download is progressing (JS only).
 		 *
 		 *  @langversion 3.0
 		 *  @playerversion Flash 10.2
@@ -278,26 +304,26 @@ package org.apache.flex.net
 			if(xhr.status == 0)
 			{
 				//Error. We don't know if there's a network error or a CORS error so there's no detail
-				dispatchEvent(new DetailEvent(HTTPConstants.COMMUNICATION_ERROR));
+				dispatchEvent(new DetailEvent("communicationError"));
 				if(onError)
 					onError(this);
 			}
 			else if(xhr.status < 200)
 			{
-				dispatchEvent(new DetailEvent(HTTPConstants.COMMUNICATION_ERROR,false,false,""+requestStatus));
+				dispatchEvent(new DetailEvent("communicationError",false,false,""+requestStatus));
 				if(onError)
 					onError(this);
 			}
 			else if(xhr.status < 300)
 			{
-				dispatchEvent(new org.apache.flex.events.Event(HTTPConstants.COMPLETE));
+				dispatchEvent(new org.apache.flex.events.Event("complete"));
 				if(onComplete)
 					onComplete(this);
 				
 			}
 			else
 			{
-				dispatchEvent(new DetailEvent(HTTPConstants.COMMUNICATION_ERROR,false,false,""+requestStatus));
+				dispatchEvent(new DetailEvent("communicationError",false,false,""+requestStatus));
 				if(onError)
 					onError(this);
 			}
@@ -317,7 +343,7 @@ package org.apache.flex.net
 			if(value != requestStatus)
 			{
 				requestStatus = value;
-				dispatchEvent(new DetailEvent(HTTPConstants.STATUS,false,false,""+value));
+				dispatchEvent(new DetailEvent("httpStatus",false,false,""+value));
 				if(onStatus)
 					onStatus(this);
 			}
@@ -376,7 +402,7 @@ package org.apache.flex.net
 		 *  @playerversion AIR 2.6
 		 *  @productversion FlexJS 0.7.0
 		 */
-		private function cleanupCallbacks():void
+		protected function cleanupCallbacks():void
 		{
 			onComplete = null;
 			onError = null;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ef400cfc/frameworks/projects/Network/src/main/flex/org/apache/flex/net/URLUploadStream.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Network/src/main/flex/org/apache/flex/net/URLUploadStream.as b/frameworks/projects/Network/src/main/flex/org/apache/flex/net/URLUploadStream.as
new file mode 100644
index 0000000..81f6c9e
--- /dev/null
+++ b/frameworks/projects/Network/src/main/flex/org/apache/flex/net/URLUploadStream.as
@@ -0,0 +1,114 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.net
+{   
+    import org.apache.flex.events.ProgressEvent;
+    
+	/**
+	 * @see URLStream
+	 * The URLUploadStream extends the URLStream class to support upload progress events.
+	 *
+	 * This class is only used for JS implementations because Flash upload events need to be handled differently.
+	 * In Flash, URLLoader does not dispatch upload events. It only dispatches download events.
+	 * To get upload events in Flash, you need to use File/FileReference.upload() and attach event listeners to that.
+	 *
+	 * Care should be taken when using this class because it attaches a progress listener to the xhr.upload object.
+	 * Doing so causes browsers to send OPTIONS requests. This will return an unauthorized response from servers not
+	 * configured to allow CORS OPTIONS requests. See this S.O. post for details. https://stackoverflow.com/a/17057853
+	 *
+	 * @langversion 3.0
+	 * @playerversion Flash 10.2
+	 * @playerversion AIR 2.6
+	 * @productversion FlexJS 0.9.0
+	 */
+    public class URLUploadStream extends URLStream
+    {
+            
+        public function URLUploadStream()
+        {
+            super();
+        }
+        
+        COMPILE::JS
+        override protected function send(requestData:Object):void
+		{
+			xhr.upload.onprogress = xhr_uploadprogress;
+			xhr.send(requestData);
+		}
+
+		/**
+		 *  Upload is progressing (JS only).
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.7.0
+		 */
+		COMPILE::JS
+        private function xhr_uploadprogress(progress:Object):void
+        {
+			var progEv:ProgressEvent = new ProgressEvent("uploadprogress");
+			progEv.current = bytesLoaded = progress["loaded"];
+			progEv.total = bytesTotal = progress["total"];
+			
+            dispatchEvent(progEv);
+			if(onUploadProgress)
+				onUploadProgress(this);
+        }
+
+		/**
+		 *  Cleanup all callbacks.
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.7.0
+		 */
+		override protected function cleanupCallbacks():void
+		{
+			super.cleanupCallbacks();
+			onUploadProgress = null;
+		}
+		
+		/**
+		 *  Callback for upload progress event.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.7.0
+		 */		
+		public var onUploadProgress:Function;
+
+		/**
+		 *  Convenience function for upload progress event to allow chaining.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.7.0
+		 */		
+		public function uploadProgress(callback:Function):org.apache.flex.net.URLStream
+		{
+			onUploadProgress = callback;
+			return this;
+		}
+	}
+}
+


Re: git commit: [flex-asjs] [refs/heads/develop] - Added support for JS upload progress events

Posted by piotrz <pi...@gmail.com>.
No problem! We have your words on Dev list! :P :)

Piotr



-----
Apache Flex PMC
piotrzarzycki21@gmail.com
--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/Re-git-commit-flex-asjs-refs-heads-develop-Added-support-for-JS-upload-progress-events-tp63275p63380.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: git commit: [flex-asjs] [refs/heads/develop] - Added support for JS upload progress events

Posted by Harbs <ha...@gmail.com>.
It’s kind of low on my priority list right now… ;-)

> On Jul 18, 2017, at 8:53 AM, piotrz <pi...@gmail.com> wrote:
> 
> Harbs,
> 
> If there is no jira around there about that - please raise one once you get
> a chance.
> 
> Thanks,
> Piotr
> 
> 
> 
> -----
> Apache Flex PMC
> piotrzarzycki21@gmail.com
> --
> View this message in context: http://apache-flex-development.2333347.n4.nabble.com/Re-git-commit-flex-asjs-refs-heads-develop-Added-support-for-JS-upload-progress-events-tp63275p63377.html
> Sent from the Apache Flex Development mailing list archive at Nabble.com.


Re: git commit: [flex-asjs] [refs/heads/develop] - Added support for JS upload progress events

Posted by piotrz <pi...@gmail.com>.
Harbs,

If there is no jira around there about that - please raise one once you get
a chance.

Thanks,
Piotr



-----
Apache Flex PMC
piotrzarzycki21@gmail.com
--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/Re-git-commit-flex-asjs-refs-heads-develop-Added-support-for-JS-upload-progress-events-tp63275p63377.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: git commit: [flex-asjs] [refs/heads/develop] - Added support for JS upload progress events

Posted by piotrz <pi...@gmail.com>.
Alex,
 +1
Thanks for such reminder! Really wish someone could start look into that!

Piotr



-----
Apache Flex PMC
piotrzarzycki21@gmail.com
--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/Re-git-commit-flex-asjs-refs-heads-develop-Added-support-for-JS-upload-progress-events-tp63275p63400.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: git commit: [flex-asjs] [refs/heads/develop] - Added support for JS upload progress events

Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,

> Can we focus more on the priorities from the summit [1]?  

Sonar Cube analysis was discussed at the summit i.e. items 5 and 6 which it can help with.

> Or maybe a feature like AMF that some folks really need?

I’m not interested in AMF support so it’s unlikely I’ll work on it.

Thanks,
Justin

Re: git commit: [flex-asjs] [refs/heads/develop] - Added support for JS upload progress events

Posted by Alex Harui <ah...@adobe.com.INVALID>.
Justin, this is not worth the time being spent on it.

Can we focus more on the priorities from the summit [1]?  Or maybe a
feature like AMF that some folks really need?

[1] 
https://lists.apache.org/thread.html/3ef2cc9fcd17bbf0c81b38c35586790255277f
bb4f727db8882920ec@%3Cdev.flex.apache.org%3E

-Alex

On 7/17/17, 11:28 PM, "Justin Mclean" <ju...@classsoftware.com> wrote:

>Hi,
>
>> No. The consensus was that the compiler needs improvement to replace
>>static constants with string literals and for now to not enforce one way
>>or the other.
>
>I’m not sure how you get that from the two threads he had on this. I’m
>happy to go through and summaries the thread for you if you want or if
>you prefer let call a VOTE and abide by the results of that?
>
>> Until the compiler is fixed, my personal preference remains to use
>>string literals.
>
>You personal preference that may be that but you changed code so that it
>not longer uses constants.
>
>>> I also note the code is using "”+requestStatus to convert a number to
>>>a string. Any reason for not using the toString or
>>>String(requestStatus) instead?
>> 
>> It’s more concise.
>
>It’s also buggy (for large numbers for instance) so I would take care in
>using it, if you were worried about null or undefined then
>String(requestStatus) will do what you need and is much clearer to
>understand.
>
>Thanks,
>Justin


Re: git commit: [flex-asjs] [refs/heads/develop] - Added support for JS upload progress events

Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,

> No. The consensus was that the compiler needs improvement to replace static constants with string literals and for now to not enforce one way or the other.

I’m not sure how you get that from the two threads he had on this. I’m happy to go through and summaries the thread for you if you want or if you prefer let call a VOTE and abide by the results of that?

> Until the compiler is fixed, my personal preference remains to use string literals.

You personal preference that may be that but you changed code so that it not longer uses constants.

>> I also note the code is using "”+requestStatus to convert a number to a string. Any reason for not using the toString or String(requestStatus) instead?
> 
> It’s more concise.

It’s also buggy (for large numbers for instance) so I would take care in using it, if you were worried about null or undefined then String(requestStatus) will do what you need and is much clearer to understand.

Thanks,
Justin

Re: git commit: [flex-asjs] [refs/heads/develop] - Added support for JS upload progress events

Posted by Harbs <ha...@gmail.com>.
> On Jul 18, 2017, at 5:41 AM, Justin Mclean <ju...@classsoftware.com> wrote:
> 
> Hi,
> 
> I can see these event name changes haven’t been reverted yet. Do you want me to do that for you?

No. The consensus was that the compiler needs improvement to replace static constants with string literals and for now to not enforce one way or the other.

Until the compiler is fixed, my personal preference remains to use string literals.

> 
> I also note the code is using "”+requestStatus to convert a number to a string. Any reason for not using the toString or String(requestStatus) instead?

It’s more concise.

> Thanks,
> Justin


Re: git commit: [flex-asjs] [refs/heads/develop] - Added support for JS upload progress events

Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,

I can see these event name changes haven’t been reverted yet. Do you want me to do that for you?

I also note the code is using "”+requestStatus to convert a number to a string. Any reason for not using the toString or String(requestStatus) instead?

Thanks,
Justin

Re: git commit: [flex-asjs] [refs/heads/develop] - Added support for JS upload progress events

Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,

Can you please revert those changes please - they are not required and not in agreement with what we have discussed on the list.

Thanks,
Justin

Re: git commit: [flex-asjs] [refs/heads/develop] - Added support for JS upload progress events

Posted by Harbs <ha...@gmail.com>.
Not really. I wrote the original code and I was making these changes anyway and some of the lines were really long.

> On Jul 15, 2017, at 4:34 AM, Justin Mclean <ju...@classsoftware.com> wrote:
> 
> Hi,
> 
> I notice in this check in you changed all of the event contestants to hard coded strings i.e. HTTPConstants.STATUS - > “httpStatus”.
> 
> Any reason for that change especially given the conversion on the dev list recently that it doesn’t matter and the using constants is the preferred way?
> 
> Thanks,
> Justin


Re: git commit: [flex-asjs] [refs/heads/develop] - Added support for JS upload progress events

Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,

I notice in this check in you changed all of the event contestants to hard coded strings i.e. HTTPConstants.STATUS - > “httpStatus”.

Any reason for that change especially given the conversion on the dev list recently that it doesn’t matter and the using constants is the preferred way?

Thanks,
Justin