mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-21 15:09:43 +00:00
game 主题支持PWA
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// 封装异步加载资源的方法
|
||||
import { memo } from 'react';
|
||||
import { memo } from 'react'
|
||||
|
||||
/**
|
||||
* 判断是否客户端
|
||||
@@ -9,18 +9,18 @@ export const isBrowser = typeof window !== 'undefined'
|
||||
|
||||
/**
|
||||
* 打乱数组
|
||||
* @param {*} array
|
||||
* @returns
|
||||
* @param {*} array
|
||||
* @returns
|
||||
*/
|
||||
export const shuffleArray = (array) => {
|
||||
if (!array) {
|
||||
return []
|
||||
}
|
||||
for (let i = array.length - 1; i > 0; i--) {
|
||||
const j = Math.floor(Math.random() * (i + 1));
|
||||
[array[i], array[j]] = [array[j], array[i]];
|
||||
}
|
||||
return array;
|
||||
export const shuffleArray = array => {
|
||||
if (!array) {
|
||||
return []
|
||||
}
|
||||
for (let i = array.length - 1; i > 0; i--) {
|
||||
const j = Math.floor(Math.random() * (i + 1))
|
||||
;[array[i], array[j]] = [array[j], array[i]]
|
||||
}
|
||||
return array
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user