Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@youngbeen/angle-ctrl

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@youngbeen/angle-ctrl - npm Package Compare versions

Comparing version
1.0.1
to
1.0.2
+73
README.md
## [@youngbeen/angle-ctrl](https://www.npmjs.com/package/@youngbeen/angle-ctrl)
### timeCtrl
引用
```
import { timeCtrl } from '@youngbeen/angle-ctrl'
```
#### 倒计时控制器 `countDown`
```
timeCtrl.countDown({
total: 60,
step: 1000,
tick: function,
end: function
})
```
* total参数可选,代表倒计时的总次数,默认60次
* step参数可选,代表倒计时的步长(单位ms),默认1000ms
* tick参数可选,代表每次计时触发的回调方法,默认空
* end参数可选,代表倒计时结束触发的回调方法,默认空
```
timeCtrl.countDown({
total: 30,
step: 2000,
tick (data) {
console.log('ticking')
console.log(data) // { leftCount: 30 }
},
end (data) {
console.log('ticking end')
console.log(data) // { leftCount: 0 }
}
})
```
#### 正计时控制器 `countUp`
```
timeCtrl.countUp({
start: 0,
total: 60,
step: 1000,
tick: function,
end: function
})
```
* start参数可选,代表正计时起始计数,默认0
* total参数可选,代表正计时结束计数,默认60
* step参数可选,代表正计时的步长(单位ms),默认1000ms
* tick参数可选,代表每次计时触发的回调方法,默认空
* end参数可选,代表计时结束触发的回调方法,默认空
```
timeCtrl.countUp({
start: 10,
total: 30,
tick (data) {
console.log('ticking')
console.log(data) // { count: 10 }
},
end (data) {
console.log('ticking end')
console.log(data) // { count: 30 }
}
})
```
+1
-1
{
"name": "@youngbeen/angle-ctrl",
"version": "1.0.1",
"version": "1.0.2",
"description": "The controllers used in angle-FE team",

@@ -5,0 +5,0 @@ "main": "index.js",