This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-10-28
Channels
- # aws (5)
- # aws-lambda (1)
- # beginners (133)
- # boot (1)
- # cljsrn (1)
- # clojure (28)
- # clojure-austin (3)
- # clojure-italy (2)
- # clojure-spec (17)
- # clojure-uk (18)
- # clojurescript (38)
- # cursive (6)
- # datomic (6)
- # figwheel (1)
- # graphql (1)
- # klipse (1)
- # leiningen (1)
- # off-topic (13)
- # onyx (30)
- # re-frame (44)
- # reagent (7)
- # shadow-cljs (77)
- # spacemacs (7)
<script>
function BlockMove(event) {
// Tell Safari not to move the window.
event.preventDefault() ;
}
</script>
<body ontouchmove="BlockMove(event);" >
...
</body>
how do I do the "ontouchmove = .... " part in cljs ?is (:require [goog.string])
supposed to get me goog.string/format ? -- if not, how do I get it ? [ I tried it, and it's getting undfined for me)
you have to require goog.string.format
as well, which defines it under goog.string/format
https://github.com/google/closure-library/blob/master/closure/goog/string/stringformat.js#L25-L39
[:rect {:width btn-w
:height btn-h
:rx 5
:ry 5
:style {:fill "#eef" :stroke "#888"}
:on-click (fn [e]
(conv/alert "click"))
:on-touch-end (fn [e]
(conv/alert "touch end"))
:on-touch-start (fn [e]
(conv/alert "touch start"))
}]
I'm using reagent. I believe I'm running into the so called '300ms ios delay" how do I get around that ?I thought the 300ms touch delay only applied to on-click events
do you still have the delay if you just rely on the on-touch events?
which browser?
my work around in the past is to just use on-touch-start instead of on-click
but it was for a cordova ios app
and cordova web app
it’s not an ideal solution because it can mess with things like scrolling
but it worked for my use case
@smith.adriane: I'm testing on an ipad air and an ipad pro
i’m not sure it’s the 300ms ios delay. a few stack overflow articles and https://developer.telerik.com/featured/300-ms-click-delay-ios-8/ seem to indicate that the delay is only for onclick
which has been my experience in the past as well
[:meta {:name "viewport" :content "user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0"}]
a few of the articles mentioned that some newer versions of safari will auto detect situations where you might want fast clicks
yeah, so I don't understand what the meta tag does, but right now, on-click is fast on ipad pro, ipad air, and iphone 6 ... so I'm going to consider it 'resolved' and move on 🙂
so if you’re planning on supporting older safari versions, it might worth checking now so you don’t have to redo things later
there’s a few things you can do to make web apps feel more native on ios Safari, https://developer.apple.com/library/content/documentation/AppleApplications/Reference/SafariWebContent/UsingtheViewport/UsingtheViewport.html#//apple_ref/doc/uid/TP40006509-SW1 and https://developer.apple.com/library/content/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html are helpful resources
[:meta {:name "apple-mobile-web-app-capable" :content "yes"}]
[:meta {:name "viewport" :content
"user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0"}]
[:meta {:name "apple-mobile-web-app-status-bar-style" :content "default"}]
[:meta {:name "viewport" :content "user-scalable=no, width=device-width"}]
[:meta {:name "mobile-web-app-capable" :content "yes"}]
it makes it so you can bookmark your webapp as a home screen icon and it feels like an almost native app
i think you can make it even run offline
$*@&$# under current config: mobile safari: on-click = instant, on-touch-start = delayed mobile chrome (on android): on-click = delayed, on-touch-start = instant 🙂
¯\(ツ)/¯