Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

o2team/timer-miniprogram

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

9 Commits

Repository files navigation

timer-miniprogram

Xiao Cheng Xu Ding Shi Qi Guan Li Ku ,Geng He Li Di Shi Yong setTimeout He setInterval,Zai Ye Mian Xian Shi Shi Zhong Qi Ding Shi Qi ,Ye Mian Yin Cang Shi Zan Ting Ding Shi Qi ,Ye Mian Xie Zai Shi Qing Chu Ding Shi Qi . Xie Zhe Ge Ku De Yuan You Xiang Kan .

Shi Yong

Ke Can Kao example Mu Lu Xia De Shi Li Xiang Mu Huo Can Zhao Yi Xia Liu Cheng :

  1. Tong Guo npm An Zhuang
npm install --save timer-miniprogram

An Zhuang Wan Cheng Zhi Hou Zai Wei Xin Kai Fa Zhe Gong Ju Zhong Dian Ji Gou Jian npm.

  1. Dao Ru Xiao Cheng Xu Gua Pei Ban Ben De timer-miniprogram
{ console.log('setTimeout') }) this.$clearTimeout(timer1) const timer2 = this.$setInterval(() => { console.log('setInterval') }) this.$clearInterval(timer2) } }) // Zai Zu Jian Zhong Shi Yong Components({ behaviors: [TimerBehavior], ready() { const timer1 = this.$setTimeout(() => { console.log('setTimeout') }) this.$clearTimeout(timer1) const timer2 = this.$setInterval(() => { console.log('setInterval') }) this.$clearInterval(timer2) } })">import { TimerBehavior } from 'timer-miniprogram'
// Zai Ye Mian Zhong Shi Yong
Page({
behaviors: [TimerBehavior],
onReady() {
const timer1 = this.$setTimeout(() => {
console.log('setTimeout')
})
this.$clearTimeout(timer1)

const timer2 = this.$setInterval(() => {
console.log('setInterval')
})
this.$clearInterval(timer2)
}
})

// Zai Zu Jian Zhong Shi Yong
Components({
behaviors: [TimerBehavior],
ready() {
const timer1 = this.$setTimeout(() => {
console.log('setTimeout')
})
this.$clearTimeout(timer1)

const timer2 = this.$setInterval(() => {
console.log('setInterval')
})
this.$clearInterval(timer2)
}
})

eslint Pei Zhi

Wei Liao Rang Tuan Dui Geng Hao Di Zun Shou Ding Shi Qi Shi Gui Fan ,Ni Huan Ke Yi Pei Zhi eslint Zeng Jia Dai Ma Ti Shi ,Pei Zhi Ru Xia :

// .eslintrc.js
module.exports = {
'rules': {
'no-restricted-globals': ['error', {
'name': 'setTimeout',
'message': 'Please use TimerBehavior and this.$setTimeout instead. see the link: https://github.com/o2team/timer-miniprogram'
}, {
'name': 'setInterval',
'message': 'Please use TimerBehavior and this.$setInterval instead. see the link: https://github.com/o2team/timer-miniprogram'
}, {
'name': 'clearInterval',
'message': 'Please use TimerBehavior and this.$clearInterval instead. see the link: https://github.com/o2team/timer-miniprogram'
}, {
'name': 'clearTimout',
'message': 'Please use TimerBehavior and this.$clearTimout instead. see the link: https://github.com/o2team/timer-miniprogram'
}]
}
}

License

MIT License

Copyright (c) 2020 AOTU Labs

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Xiao Cheng Xu Ding Shi Qi Guan Li Ku ,Geng He Li Di Shi Yong setTimeout He setInterval,Zai Ye Mian Xian Shi Shi Zhong Qi Ding Shi Qi ,Ye Mian Yin Cang Shi Zan Ting Ding Shi Qi ,Ye Mian Xie Zai Shi Qing Chu Ding Shi Qi

Topics

Resources

Readme

License

MIT license

Stars

Watchers

Forks

Packages

Contributors