This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-04-21
Channels
- # aws (1)
- # aws-lambda (1)
- # beginners (27)
- # boot (16)
- # cider (1)
- # clara (54)
- # cljs-dev (4)
- # cljsjs (8)
- # cljsrn (25)
- # clojure (148)
- # clojure-dev (2)
- # clojure-finland (1)
- # clojure-france (18)
- # clojure-italy (10)
- # clojure-nl (3)
- # clojure-russia (27)
- # clojure-sg (2)
- # clojure-uk (17)
- # clojurebridge (6)
- # clojurescript (70)
- # core-async (1)
- # css (6)
- # cursive (35)
- # data-science (3)
- # datomic (22)
- # events (4)
- # jobs (18)
- # jobs-discuss (14)
- # leiningen (4)
- # lumo (22)
- # off-topic (20)
- # om (5)
- # om-next (1)
- # onyx (47)
- # pedestal (107)
- # re-frame (43)
- # reagent (1)
- # ring (2)
- # ring-swagger (2)
- # rum (18)
- # sql (15)
- # unrepl (4)
- # vim (61)
- # yada (3)
I'm trying out rum with re-natal, just trying a few things. I want to add push notifications with OneSignal https://github.com/geektimecoil/react-native-onesignal I'm stuck at https://github.com/geektimecoil/react-native-onesignal#usage , translating this to rum/cljs:
OneSignal.addEventListener('received', this.onReceived);
OneSignal.addEventListener('opened', this.onOpened);
OneSignal.addEventListener('registered', this.onRegistered);
OneSignal.addEventListener('ids', this.onIds);
This is how far I got:
(def OneSignal (js/require "react-native-onesignal"))
(def one-signal-mixin
{
:will-mount (fn [state]
(doto OneSignal
(.addEventListener 'received', this.onReceived)
(.addEventListener 'opened', this.onOpened)
(.addEventListener 'registered', this.onRegistered)
(.addEventListener 'ids', this.onIds))
state)
})
but, this.onxxx
, what is the this
?@jeroenvandijk is that some special component that breaks everything or any component does? Can you create an issue, I’ll see what can be done about it
@kurt-o-sys there’s no “this” in rum component
Yeah, I know, but how do I 'translate' the this
inside the mixin?
@tonsky I think it breaks for any component, but I’ll double check. I am doing some weird things with routing and stuartsierra’s Component lib (and some other things), so I’ll try to make a minimal example where this also happens
@kurt-o-sys it’s not clear what this
is in js code either
oh, ok...
thx... I'll check it - it's probably the Component
itself... I'll check.
@jeroenvandijk even if you doesn’t have minimal case, just create an issue so I don’t forget
Done 🙂
@kurt-o-sys I think you just need to define inline callbacks there with whatever signature is expected (`(fn [e] ...)` or (fn [ids] ...)
), like
:will-mount (fn [state]
(doto OneSignal
(.addEventListener 'received', (fn [e] ...))
...
state)
Yeah, right... it's just adding functions 😛
and since you are wrapping this up in a reusable mixin - you might receive those as mixin arguments, or fetch from state, or whatever you'll come up with
oh... right, for now, I just defined functions. Will see if it works fine.