code: function init() {
          if (isInitialized) {
              return;
          }
      
          isInitialized = true;
      
          // Watch for scroll position changes and trigger recalc/refresh if needed
          function checkScroll() {
              if (window.pageXOffset != scroll.left) {
                  scroll.top = window.pageYOffset;
                  scroll.left = window.pageXOffset;
      
                  Stickyfill.refreshAll();
              } else if (window.pageYOffset != scroll.top) {
                  scroll.top = window.pageYOffset;
                  scroll.left = window.pageXOffset;
      
                  // recalc position for all stickies
                  stickies.forEach(function (sticky) {
                      return sticky._recalcPosition();
                  });
              }
          }
      
          checkScroll();
          window.addEventListener('scroll', checkScroll);
      
          // Watch for window resizes and device orientation changes and trigger refresh
          window.addEventListener('resize', Stickyfill.refreshAll);
          window.addEventListener('orientationchange', Stickyfill.refreshAll);
      
          //Fast dirty check for layout changes every 500ms
          var fastCheckTimer = void 0;
      
          function startFastCheckTimer() {
              fastCheckTimer = setInterval(function () {
                  stickies.forEach(function (sticky) {
                      return sticky._fastCheck();
                  });
              }, 500);
          }
      
          function stopFastCheckTimer() {
              clearInterval(fastCheckTimer);
          }
      
          var docHiddenKey = void 0;
          var visibilityChangeEventName = void 0;
      
          if ('hidden' in document) {
              docHiddenKey = 'hidden';
              visibilityChangeEventName = 'visibilitychange';
          } else if ('webkitHidden' in document) {
              docHiddenKey = 'webkitHidden';
              visibilityChangeEventName = 'webkitvisibilitychange';
          }
      
          if (visibilityChangeEventName) {
              if (!document[docHiddenKey]) startFastCheckTimer();
      
              document.addEventListener(visibilityChangeEventName, function () {
                  if (document[docHiddenKey]) {
                      stopFastCheckTimer();
                  } else {
                      startFastCheckTimer();
                  }
              });
          } else startFastCheckTimer();
      }
docs: /*
  6. Setup events (unless the polyfill was disabled)