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?

4

1 回答 1

0

最好通过ns.

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

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

如果必须,您可以使用(let [ScrollTrigger (js/require "...") ...] ...).

于 2019-03-28T21:48:37.030 回答