code: function (callback) {
              var support   = self.isSupported();
              var prerender = 'prerender';
  
              if ( !support || prerender != self.state() ) {
                  callback();
                  return support;
              }
  
              var listener = self.change(function (e, state) {
                  if ( prerender != state ) {
                      self.unbind(listener);
                      callback();
                  }
              });
              return listener;
          }
docs: Call `callback` in any state, expect “prerender”. If current state is “prerender” it will wait until state will be changed. If Page Visibility API doesn’t supported, it will call `callback` immediately.  Return false if API isn’t supported, true if page is already after prerendering or listener ID (you can use it in `unbind` method) if page is prerended now.  Visibility.afterPrerendering(function () { Statistics.countVisitor(); });