Skip to content
Browse files

fix bug in iframe io for polling case

1 parent 8d0f98a commit 87c08c3e731fa1c9564d9f2261d6688d8f54658e John A. De Goes committed
Showing with 46 additions and 7 deletions.
  1. +1 −1 demo.sh
  2. +4 −4 src/demo/haxe/Demo.hx
  3. +36 −0 src/main/haxe/haxe/data/collections/MapExtensions.hx
  4. +5 −2 src/main/haxe/js/io/IFrameIO.hx
View
2 demo.sh
@@ -1,4 +1,4 @@
#!/bin/sh
haxe -cp ./src/main/haxe/ -cp ./src/demo/haxe/ -js demo.js --js-namespace hxroot -main Demo
-tools/minify-js < demo.js > demo.min.js
+#tools/minify-js < demo.js > demo.min.js
open demo.html
View
8 src/demo/haxe/Demo.hx
@@ -199,12 +199,12 @@ class Demo {
}
public static function main() {
- Injector.enter(function(c) {
+ Injector.forever(function(c) {
c.bind(ScheduledExecutor, ScheduledExecutorSystem);
+ });
- iframeDemo();
+ iframeDemo();
- browserSupportDemo();
- });
+ //browserSupportDemo();
}
}
View
36 src/main/haxe/haxe/data/collections/MapExtensions.hx
@@ -0,0 +1,36 @@
+/*
+ HaXe library written by John A. De Goes <john@socialmedia.com>
+ Contributed by Social Media Networks
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ THIS SOFTWARE IS PROVIDED BY SOCIAL MEDIA NETWORKS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOCIAL MEDIA NETWORKS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+package haxe.data.collections;
+
+import Prelude;
+import PreludeExtensions;
+
+import haxe.functional.Foldable;
+import haxe.data.collections.Map;
+
+using PreludeExtensions;
+using haxe.functional.FoldableExtensions;
+
+class MapExtensions {
+ public static function toObject<V>(map: Map<String, V>): Dynamic<V> {
+ return map.foldl({}, function(object, tuple) {
+ Reflect.setField(object, tuple._1, tuple._2);
+
+ return object;
+ });
+ }
+}
View
7 src/main/haxe/js/io/IFrameIO.hx
@@ -32,6 +32,7 @@ using PreludeExtensions;
using haxe.functional.FoldableExtensions;
using haxe.util.StringExtensions;
using haxe.data.collections.IterableExtensions;
+using haxe.data.collections.MapExtensions;
using haxe.net.UrlExtensions;
using haxe.framework.Injector;
@@ -303,6 +304,8 @@ class IFrameIOPollingHashtag extends AbstractIFrameIO, implements IFrameIO {
var senderFuture: Option<Future<Void>>;
var receiverFuture: Option<Future<Void>>;
+ static var log = Logger.debug();
+
public function new(w: Window) {
super();
@@ -397,7 +400,7 @@ class IFrameIOPollingHashtag extends AbstractIFrameIO, implements IFrameIO {
var window = tuple._1;
var fragment = tuple._2;
-
+
// Send this chunk via the hash tag:
window.location.href = fragment.to + '#' + fragment.toMap().toQueryString().substr(1);
}
@@ -409,7 +412,7 @@ class IFrameIOPollingHashtag extends AbstractIFrameIO, implements IFrameIO {
if (hash.length > 1) {
var query = '?' + hash.substr(1);
- var unknown: Dynamic = query.toQueryParameters();
+ var unknown: Dynamic = query.toQueryParameters().toObject();
if (unknown.type == 'delivery') {
var packet: FragmentDelivery = cast unknown;

0 comments on commit 87c08c3

Please sign in to comment.
Something went wrong with that request. Please try again.