on master help sign in
Merge pull request #585 from Xashili/array

Fix #576 for Array when having ports with tuples

commit6467333b56212158a558060fdaa97af17c137753 authorEvan Czaplicki <info@elm-lang.org> dateTue 15 Apr 2014, 15:53 (13 years ago) parent97c94756211862
2 files changed+6−1
compiler/Generate/JavaScript/Ports.hs+1−1 libraries/Native/Utils.js+5
compiler/Generate/JavaScript/Ports.hs+1−1
@@ -20,7 +20,7 @@ check x jsType continue =
2020 JSNumber -> [typeof "number"]
2121 JSBoolean -> [typeof "boolean"]
2222 JSString -> [typeof "string", instanceof "String"]
23− JSArray -> [instanceof "Array"]
23+ JSArray -> [(obj "_U.isJSArray" <|)]
2424 JSObject fields -> [jsFold OpLAnd (typeof "object" : map member fields)]
2525
2626incoming :: Type -> Expression ()
libraries/Native/Utils.js+5
@@ -210,6 +210,10 @@ Elm.Native.Utils.make = function(elm) {
210210 return Tuple2(posx, posy);
211211 }
212212
213+ function isJSArray(a) {
214+ return a instanceof Array;
215+ }
216+
213217 return elm.Native.Utils.values = {
214218 eq:eq,
215219 cmp:cmp,
@@ -229,6 +233,7 @@ Elm.Native.Utils.make = function(elm) {
229233 mod : F2(mod),
230234 htmlHeight: F2(htmlHeight),
231235 getXY: getXY,
236+ isJSArray: isJSArray,
232237 toFloat: function(x) { return +x; }
233238 };
234239};