-
-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor artplayerPluginLibass to use ES6 syntax
- Loading branch information
1 parent
4360c1e
commit b2bffa8
Showing
4 changed files
with
11 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,8 @@ | ||
import LibassAdapter from './adapter' | ||
|
||
function checkVersion(art) { | ||
const { | ||
version, | ||
utils: { errorHandle }, | ||
} = art.constructor | ||
const arr = version.split('.').map(Number) | ||
const major = arr[0] | ||
const minor = arr[1] / 100 | ||
errorHandle( | ||
major + minor >= 5, | ||
`Artplayer.js@${version} is not compatible the artplayerPluginLibass@${artplayerPluginLibass.version}. Please update it to version [email protected]`, | ||
) | ||
} | ||
import LibassAdapter from './adapter'; | ||
|
||
export default function artplayerPluginLibass(option) { | ||
return (art) => { | ||
checkVersion(art) | ||
|
||
let adapter = new LibassAdapter(art, option) | ||
|
||
const adapter = new LibassAdapter(art, option); | ||
return { | ||
name: 'artplayerPluginLibass', | ||
libass: adapter.libass, | ||
|
@@ -29,14 +12,10 @@ export default function artplayerPluginLibass(option) { | |
show: adapter.show.bind(adapter), | ||
hide: adapter.hide.bind(adapter), | ||
destroy: adapter.destroy.bind(adapter), | ||
} | ||
} | ||
}; | ||
}; | ||
} | ||
|
||
artplayerPluginLibass.env = process.env.NODE_ENV | ||
artplayerPluginLibass.version = process.env.APP_VER | ||
artplayerPluginLibass.build = process.env.BUILD_DATE | ||
|
||
if (typeof window !== 'undefined') { | ||
window['artplayerPluginLibass'] = artplayerPluginLibass | ||
window['artplayerPluginLibass'] = artplayerPluginLibass; | ||
} |
b2bffa8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
art-player – ./
art-player-git-master-harvey-zhao.vercel.app
art-player.vercel.app
art-player-harvey-zhao.vercel.app
www.artplayer.org
artplayer.org