(defn
custom-wrapper
[key f]
(case
key
:getDefaultProps
(throw (js/Error. "getDefaultProps not supported"))
:getInitialState
(fn
getInitialState
[]
(this-as c (reset! (state-atom c) (.call f c c))))
:componentWillReceiveProps
(fn
componentWillReceiveProps
[nextprops]
(this-as c (.call f c c (props-argv c nextprops))))
:shouldComponentUpdate
(fn
shouldComponentUpdate
[nextprops nextstate]
(or
util/*always-update*
(this-as
c
(let
[old-argv
($ c :props.argv)
new-argv
($ nextprops :argv)
noargv
(or (nil? old-argv) (nil? new-argv))]
(cond
(nil? f)
(or noargv (not= old-argv new-argv))
noargv
(.call f c c (get-argv c) (props-argv c nextprops))
:else
(.call f c c old-argv new-argv))))))
:componentWillUpdate
(fn
componentWillUpdate
[nextprops]
(this-as c (.call f c c (props-argv c nextprops))))
:componentDidUpdate
(fn
componentDidUpdate
[oldprops]
(this-as c (.call f c c (props-argv c oldprops))))
:componentWillMount
(fn
componentWillMount
[]
(this-as
c
($! c :cljsMountOrder (batch/next-mount-count))
(when-not (nil? f) (.call f c c))))
:componentDidMount
(fn componentDidMount [] (this-as c (.call f c c)))
:componentWillUnmount
(fn
componentWillUnmount
[]
(this-as
c
(some-> ($ c :cljsRatom) ratom/dispose!)
(batch/mark-rendered c)
(when-not (nil? f) (.call f c c))))
:componentDidCatch
(fn
componentDidCatch
[error info]
(this-as c (.call f c c error info)))
nil))