From e7633ed49d5c7acb87b59ee83c5de96048c25ad7 Mon Sep 17 00:00:00 2001 From: Harvey Zack Date: Sun, 17 Aug 2025 18:30:23 +0800 Subject: [PATCH] fix: update window export syntax for plugin; ensure compatibility with global scope feat: add example usage for artplayer-plugin-test in test.js --- docs/assets/example/test.js | 12 ++++++++++++ scripts/plugin/template/src/index.js | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 docs/assets/example/test.js diff --git a/docs/assets/example/test.js b/docs/assets/example/test.js new file mode 100644 index 000000000..c53700cc1 --- /dev/null +++ b/docs/assets/example/test.js @@ -0,0 +1,12 @@ +// npm i artplayer-plugin-test +// import artplayerPluginTest from 'artplayer-plugin-test'; + +var art = new Artplayer({ + container: '.artplayer-app', + url: '/assets/sample/video.mp4', + plugins: [ + artplayerPluginTest({ + // + }), + ], +}); \ No newline at end of file diff --git a/scripts/plugin/template/src/index.js b/scripts/plugin/template/src/index.js index d3933ae81..d98d25eec 100644 --- a/scripts/plugin/template/src/index.js +++ b/scripts/plugin/template/src/index.js @@ -27,5 +27,5 @@ if (typeof document !== 'undefined') { } if (typeof window !== 'undefined') { - window['{{export}}'] = {{export}}; + window.{{export}} = {{export}}; }