mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-27 01:21:20 -08:00
优化回调参数
This commit is contained in:
1 parent
2385128abb
commit
62c05ef659
5 files changed
+44
-31
No files matched your search
@@ -1,4 +1,20 @@
|
||||
import validElement from './validElement';
|
||||
import { ArtPlayerError } from '../utils';
|
||||
|
||||
function validElement(paths, value, type) {
|
||||
if (type === 'string') {
|
||||
if (value.trim() === '') {
|
||||
throw new ArtPlayerError(`${paths.join('.')} can not be empty`);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (value instanceof Element) {
|
||||
return true;
|
||||
}
|
||||
|
||||
throw new ArtPlayerError(`${paths.join('.')} require 'string' or 'Element' type, but got '${type}'`);
|
||||
}
|
||||
|
||||
export default {
|
||||
container: {
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
import { ArtPlayerError } from '../utils';
|
||||
|
||||
export default function validElement(paths, value, type) {
|
||||
if (type === 'string') {
|
||||
if (value.trim() === '') {
|
||||
throw new ArtPlayerError(`${paths.join('.')} can not be empty`);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (value instanceof Element) {
|
||||
return true;
|
||||
}
|
||||
|
||||
throw new ArtPlayerError(`${paths.join('.')} require 'string' or 'Element' type, but got '${type}'`);
|
||||
}
|
||||
Reference in new issue
Block a user