@/utils#debounce JavaScript Examples

The following examples show how to use @/utils#debounce. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: utils.js    From lx-music-mobile with Apache License 2.0 7 votes vote down vote up
debounceSearchList = debounce((text, list, callback) => {
  const reslutList = []
  if (!text.length) return
  let rxp = new RegExp(text.split('').map(s => s.replace(/[.*+?^${}()|[\]\\]/, '\\$&')).join('.*') + '.*', 'i')
  for (const item of list) {
    if (rxp.test(`${item.name}${item.singer}${item.albumName ? item.albumName : ''}`)) reslutList.push(item)
  }
  // console.log(reslutList)
  callback(handleSortList(reslutList, text))
}, 200)
Example #2
Source File: index.jsx    From react-antd-admin-template with MIT License 5 votes vote down vote up
componentWillReceiveProps(nextProps) {
    if (nextProps.sidebarCollapsed !== this.props.sidebarCollapsed) {
      this.resize();
    }
    if (nextProps.chartData !== this.props.chartData) {
      debounce(this.initChart.bind(this), 300)();
    }
  }
Example #3
Source File: Input.js    From lx-music-mobile with Apache License 2.0 5 votes vote down vote up
debounceTipSearch = debounce((str, tempSearchSource, callback) => {
  return music[tempSearchSource].tempSearch.search(str).then(callback)
}, 200)
Example #4
Source File: index.jsx    From react-antd-admin-template with MIT License 5 votes vote down vote up
resize() {
    const chart = this.state.chart;
    if (chart) {
      debounce(chart.resize.bind(this), 300)();
    }
  }
Example #5
Source File: index.jsx    From react-antd-admin-template with MIT License 5 votes vote down vote up
componentWillReceiveProps(nextProps) {
    if (nextProps.sidebarCollapsed !== this.props.sidebarCollapsed) {
      this.resize();
    }
    if (nextProps.chartData !== this.props.chartData) {
      debounce(this.initChart.bind(this), 300)();
    }
  }
Example #6
Source File: index.jsx    From react-antd-admin-template with MIT License 5 votes vote down vote up
componentDidMount() {
    debounce(this.initChart.bind(this), 300)();
    window.addEventListener("resize", () => this.resize());
  }
Example #7
Source File: index.jsx    From react-antd-admin-template with MIT License 5 votes vote down vote up
resize() {
    const chart = this.state.chart;
    if (chart) {
      debounce(chart.resize.bind(this), 300)();
    }
  }
Example #8
Source File: index.jsx    From react-antd-admin-template with MIT License 5 votes vote down vote up
componentWillReceiveProps(nextProps) {
    if (nextProps.sidebarCollapsed !== this.props.sidebarCollapsed) {
      this.resize();
    }
    if (nextProps.chartData !== this.props.chartData) {
      debounce(this.initChart.bind(this), 300)();
    }
  }
Example #9
Source File: index.jsx    From react-antd-admin-template with MIT License 5 votes vote down vote up
componentDidMount() {
    debounce(this.initChart.bind(this), 300)();
    window.addEventListener("resize", () => this.resize());
  }
Example #10
Source File: index.jsx    From react-antd-admin-template with MIT License 5 votes vote down vote up
resize() {
    const chart = this.state.chart;
    if (chart) {
      debounce(chart.resize.bind(this), 300)();
    }
  }
Example #11
Source File: keyboard.jsx    From react-antd-admin-template with MIT License 5 votes vote down vote up
componentDidMount() {
    debounce(this.initChart.bind(this), 300)();
    window.addEventListener("resize", () => this.resize());
  }
Example #12
Source File: index.jsx    From react-antd-admin-template with MIT License 5 votes vote down vote up
componentDidMount() {
    debounce(this.initChart.bind(this), 300)();
    window.addEventListener("resize", () => this.resize());
  }
Example #13
Source File: index.jsx    From react-antd-admin-template with MIT License 5 votes vote down vote up
resize() {
    const chart = this.state.chart;
    if (chart) {
      debounce(chart.resize.bind(this), 300)();
    }
  }
Example #14
Source File: index.jsx    From react-antd-admin-template with MIT License 5 votes vote down vote up
componentWillReceiveProps(nextProps) {
    if (nextProps.sidebarCollapsed !== this.props.sidebarCollapsed) {
      this.resize();
    }
    if (nextProps.chartData !== this.props.chartData) {
      debounce(this.initChart.bind(this), 300)();
    }
  }
Example #15
Source File: index.jsx    From react-antd-admin-template with MIT License 5 votes vote down vote up
componentDidMount() {
    debounce(this.initChart.bind(this), 300)();
    window.addEventListener("resize", () => this.resize());
  }
Example #16
Source File: mixChart.jsx    From react-antd-admin-template with MIT License 5 votes vote down vote up
resize() {
    const chart = this.state.chart;
    if (chart) {
      debounce(chart.resize.bind(this), 300)();
    }
  }
Example #17
Source File: mixChart.jsx    From react-antd-admin-template with MIT License 5 votes vote down vote up
componentDidMount() {
    debounce(this.initChart.bind(this), 300)();
    window.addEventListener("resize", () => this.resize());
  }
Example #18
Source File: line.jsx    From react-antd-admin-template with MIT License 5 votes vote down vote up
resize() {
    const chart = this.state.chart;
    if (chart) {
      debounce(chart.resize.bind(this), 300)();
    }
  }
Example #19
Source File: line.jsx    From react-antd-admin-template with MIT License 5 votes vote down vote up
componentDidMount() {
    debounce(this.initChart.bind(this), 300)();
    window.addEventListener("resize", () => this.resize());
  }
Example #20
Source File: keyboard.jsx    From react-antd-admin-template with MIT License 5 votes vote down vote up
resize() {
    const chart = this.state.chart;
    if (chart) {
      debounce(chart.resize.bind(this), 300)();
    }
  }