How to use the @better-scroll/shared-utils.Probe.Realtime function in @better-scroll/shared-utils

To help you get started, we’ve selected a few @better-scroll/shared-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ustbhuangyi / better-scroll / packages / pull-up / src / index.ts View on Github external
private _watch() {
    if (this.watching) {
      return
    }
    // must watch scroll in real time
    this.bscroll.options.probeType = Probe.Realtime
    this.watching = true
    this.bscroll.on('scroll', this._checkToEnd, this)
  }
github ustbhuangyi / better-scroll / packages / core / src / animater / Transition.ts View on Github external
move(
    startPoint: TranslaterPoint,
    endPoint: TranslaterPoint,
    time: number,
    easingFn: string | EaseFn,
    isSlient?: boolean
  ) {
    this.setPending(
      time > 0 && (startPoint.x !== endPoint.x || startPoint.y !== endPoint.y)
    )
    this.transitionTimingFunction(easingFn as string)
    this.transitionTime(time)
    this.translate(endPoint)

    if (time && this.options.probeType === Probe.Realtime) {
      this.startProbe()
    }

    // if we change content's transformY in a tick
    // such as: 0 -> 50px -> 0
    // transitionend will not be triggered
    // so we forceupdate by reflow
    if (!time) {
      this._reflow = this.content.offsetHeight
    }

    // no need to dispatch move and end when slient
    if (!time && !isSlient) {
      this.hooks.trigger(this.hooks.eventTypes.move, endPoint)

      this.hooks.trigger(this.hooks.eventTypes.end, endPoint)
github ustbhuangyi / better-scroll / packages / pull-down / src / index.ts View on Github external
private _watch() {
    // 需要设置 probe = 3 吗?
    // must watch scroll in real time
    this.scroll.options.probeType = Probe.Realtime
    this.scroll.scroller.hooks.on('end', this._checkPullDown, this)
  }
github ustbhuangyi / better-scroll / packages / infinity / src / index.ts View on Github external
constructor(public bscroll: BScroll) {
    if (bscroll.options.infinity) {
      this.bscroll.options.probeType = Probe.Realtime
      this.bscroll.scroller.scrollBehaviorY.hasScroll = true
      this.bscroll.scroller.scrollBehaviorY.maxScrollPos = EXTRA_SCROLL_Y

      this.init(bscroll.options.infinity)
    }
  }
github ustbhuangyi / better-scroll / packages / core / src / scroller / Scroller.ts View on Github external
private transitionEnd(e: TouchEvent) {
    if (e.target !== this.content || !this.animater.pending) {
      return
    }
    const animater = this.animater as Transition
    animater.transitionTime()

    if (!this.resetPosition(this.options.bounceTime, ease.bounce)) {
      this.animater.setPending(false)
      if (this.options.probeType !== Probe.Realtime) {
        this.hooks.trigger(
          this.hooks.eventTypes.scrollEnd,
          this.getCurrentPos()
        )
      }
    }
  }