Skip to content

Commit

Permalink
fix some bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
saqqdy committed Mar 11, 2024
1 parent 3506745 commit d5e9ae9
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change logs

## 2024.03.11 v5.18.1

1. fix types
2. fix export error

## 2024.03.07 v5.18.0

1. new `punctualTimer` function, see: [punctualTimer](https://github.com/saqqdy/js-cool#punctualtimer)
Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2485,7 +2485,16 @@ punctualTimer(printDate, 1000)
- Types:

```ts
declare function punctualTimer<T extends Function>(handler: T, delay: number, ...args: any[]): void
declare function punctualTimer<TArgs extends any[]>(
handler: (args: void) => void,
delay: number,
[...args]?: TArgs
): void
declare function punctualTimer<TArgs extends any[]>(
handler: (...args: TArgs) => void,
delay: number,
[...args]?: TArgs
): void
```

#### promiseFactory
Expand Down
1 change: 0 additions & 1 deletion api-extractor.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"logLevel": "warning",
"addToApiReportFile": true
},

"ae-missing-release-tag": {
"logLevel": "none"
}
Expand Down
2 changes: 2 additions & 0 deletions src/index.default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ import urlToBlob from './urlToBlob'

import { awaitTo, loadSource, mountCss, mountImg, mountJs, mountStyle } from './'

export type * from './types'

export default {
version: '__VERSION__',
download,
Expand Down
3 changes: 1 addition & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
export type * from './types'

export { default as loadSource } from 'load-source'
export { default as mountCss } from 'mount-css'
export { default as mountImg } from 'mount-image'
Expand Down Expand Up @@ -163,4 +161,5 @@ export { default as svgToBlob } from './svgToBlob'
export { default as urlToBlob } from './urlToBlob'

export { default } from './index.default'
export type * from './index.default'
export const version = '__VERSION__' as string
12 changes: 11 additions & 1 deletion src/punctualTimer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,17 @@
* @param delay - The time, in milliseconds that the timer should wait before the specified function or code is executed. If this parameter is omitted, a value of 0 is used, meaning execute "immediately", or more accurately, the next event cycle.
* @param args - Additional arguments which are passed through to the function specified by handler.
*/
function punctualTimer<T extends Function>(handler: T, delay: number, ...args: any[]) {
function punctualTimer<TArgs extends any[]>(
handler: (args: void) => void,
delay: number,
[...args]?: TArgs
): void
function punctualTimer<TArgs extends any[]>(
handler: (...args: TArgs) => void,
delay: number,
[...args]?: TArgs
): void
function punctualTimer<TArgs extends any[]>(handler: any, delay: number, ...args: TArgs) {
handler()
let counter = 1
const start = new Date().getTime()
Expand Down

0 comments on commit d5e9ae9

Please sign in to comment.