0

In JavaScript there is the idiom:

const ScrollTrigger = require('ScrollTrigger-classes');

var trigger = new ScrollTrigger({
  once: true
 });

How do I do the same thing in ClojureScript using Shadow-CLJS for npm modules?

chris_l
  • 57
  • 6

1 Answers1

0

Preferably you do this via the ns.

(ns your.thing
  (:require ["ScrollTrigger-classes" :as ScrollTrigger]))

(let [trigger (ScrollTrigger. #js {:once true})]
  ...)

If you must you can just use (let [ScrollTrigger (js/require "...") ...] ...).

Thomas Heller
  • 3,842
  • 1
  • 9
  • 9
  • That works, thanks. I was missing the trailing dot. Still can't trigger a scroll position with it, but that is a different question... – chris_l Mar 29 '19 at 11:28