Skip to content

Commit 56fd96b

Browse files
committed
fix: update return type annotations for lazyLoad, once, prefetch, and preload functions
1 parent f08dab3 commit 56fd96b

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/perf/lazyLoad.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ const loadingDefault
99
*
1010
* @param { MaybeElement } element 元素
1111
* @param { string } loadingUrl 懒加载的loading图
12-
* @returns
12+
* @returns { Function } 停止懒加载的函数
1313
*/
1414
export function lazyLoad(element: MaybeElement, loadingUrl = loadingDefault) {
1515
return mount(element, (el) => {
16-
(
16+
;(
1717
findElement(['img', 'video'], true, el) as unknown as (
1818
| HTMLImageElement
1919
| HTMLVideoElement

src/perf/once.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* 只执行一次函数
33
* @param { Function } fn 函数
4-
* @returns
4+
* @returns { Function } 函数
55
*/
66
export function once(fn: Function): Function {
77
let called = false

src/perf/prefetch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { useRic } from './useRic'
66
* 借助浏览器空闲时间去加载一些图片资源
77
* @param { string[] } list 图片或视频地址数组
88
* @param { number } timeRemaining 浏览器空闲时间大于多少去加载
9-
* @returns stop 取消副作用
9+
* @returns { Function } 停止加载的函数
1010
*/
1111
export function prefetch(list: string[], timeRemaining = 0) {
1212
const imageNode = new Image()

src/perf/preload.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { createElement } from '../event/createElement'
66
* 图片视频预加载函数
77
* @param { string[] } list 图片数组
88
* @param { string } style 设置样式
9-
* @returns
9+
* @returns { HTMLImageElement[] } 图片数组
1010
*/
1111
export function preload(list: string[] | string, style?: string) {
1212
let imageNode: HTMLImageElement

0 commit comments

Comments
 (0)