docs: function createHistory(source) {
      let listeners = [];
    
      let transitioning = false;
      let resolveTransition = () => {};
      let target = {
  
          //减少魔法，提高兼容性，将只读的访问器属性改成普通属性
          location: getLocation(source),
  
          transitioning,
  
          _onTransitionComplete() {
              target.transitioning = transitioning = false;
              resolveTransition();
          },
  
          listen(listener) {
              listeners.push(listener);
  
              let popstateListener = (e) => {      
                  target.location = getLocation(source)
                  listener();
              };
              var event = modeObject.value === "hash" ? "hashchange" : "popstate"
              addEvent(source, event, popstateListener);
              return () => {
                  removeEvent(source, event, popstateListener);
                  listeners = listeners.filter(fn => fn !== listener);
              };
          },
  
          navigate(to, {
              state,
              replace = false
          } = {}) {
              state = { ...state,
                  key: Date.now() + ""
              };
              // try...catch iOS Safari limits to 100 pushState calls
              var slocation = source.location
              if (modeObject.value === "hash") {
                  if (replace && slocation.hash !== newHash) {
                      history.back()
                  }
                  slocation.hash = to
              } else {
                  try {
                      if (transitioning || replace) {
                          source.history.replaceState(state, null, to);
                      } else {
                          source.history.pushState(state, null, to);
                      }
                  } catch (e) {
                      slocation[replace ? "replace" : "assign"](to);
                  }
              }
  
  
              target.location = getLocation(source);
  
              target.transitioning = transitioning = true;
  
              let transition = new Promise(res => (resolveTransition = res));
              listeners.forEach(fn => fn());
              return transition;
          }
      };
      return target;
  }