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?

1 Answer 1

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 "...") ...] ...).

Sign up to request clarification or add additional context in comments.

1 Comment

That works, thanks. I was missing the trailing dot. Still can't trigger a scroll position with it, but that is a different question...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.