MCPcopy
hub / github.com/greensock/GSAP / _initCore

Function _initCore

src/Observer.js:123–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121 ScrollTrigger && ScrollTrigger.core && _integrate();
122 },
123 _initCore = core => {
124 gsap = core || _getGSAP();
125 if (!_coreInitted && gsap && typeof(document) !== "undefined" && document.body) {
126 _win = window;
127 _doc = document;
128 _docEl = _doc.documentElement;
129 _body = _doc.body;
130 _root = [_win, _doc, _docEl, _body];
131 _clamp = gsap.utils.clamp;
132 _context = gsap.core.context || function() {};
133 _pointerType = "onpointerenter" in _body ? "pointer" : "mouse";
134 // isTouch is 0 if no touch, 1 if ONLY touch, and 2 if it can accommodate touch but also other types like mouse/pointer.
135 _isTouch = Observer.isTouch = _win.matchMedia && _win.matchMedia("(hover: none), (pointer: coarse)").matches ? 1 : ("ontouchstart" in _win || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0) ? 2 : 0;
136 _eventTypes = Observer.eventTypes = ("ontouchstart" in _docEl ? "touchstart,touchmove,touchcancel,touchend" : !("onpointerdown" in _docEl) ? "mousedown,mousemove,mouseup,mouseup" : "pointerdown,pointermove,pointercancel,pointerup").split(",");
137 setTimeout(() => _startup = 0, 500);
138 _coreInitted = 1;
139 }
140 ScrollTrigger || _setScrollTrigger(); // Observer might be initted BEFORE ScrollTrigger, so don't put this with the initting code. ScrollTrigger will call Observer.register() when it inits.
141 return _coreInitted;
142 };
143
144_horizontal.op = _vertical;
145_scrollers.cache = 0;

Callers 1

initMethod · 0.70

Calls 3

_getGSAPFunction · 0.70
_setScrollTriggerFunction · 0.70
splitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…