mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-23 22:01:20 -08:00
add proxy() to instance
This commit is contained in:
1 parent
177ded8c2c
commit
47128ecf9d
44 files changed
+164
-109
No files matched your search
@@ -100,6 +100,32 @@ art.on('ready', () => {
|
||||
});
|
||||
```
|
||||
|
||||
## events
|
||||
|
||||
- Type: `Object`
|
||||
|
||||
Manage the `events`
|
||||
|
||||
## proxy
|
||||
|
||||
- Type: `Function`
|
||||
|
||||
Proxy native event method, easy to manage and destroy the event
|
||||
|
||||
<div className="run-code">▶ Run Code</div>
|
||||
|
||||
```js
|
||||
var container = document.querySelector('.artplayer-app');
|
||||
var art = new Artplayer({
|
||||
container: container,
|
||||
url: '/assets/sample/video.mp4',
|
||||
});
|
||||
|
||||
art.proxy(container, 'click', (event) => {
|
||||
console.info(event);
|
||||
});
|
||||
```
|
||||
|
||||
## storage
|
||||
|
||||
- Type: `Object`
|
||||
|
||||
@@ -100,6 +100,32 @@ art.on('ready', () => {
|
||||
});
|
||||
```
|
||||
|
||||
## events
|
||||
|
||||
- 类型: `Object`
|
||||
|
||||
管理事件发生的对象
|
||||
|
||||
## proxy
|
||||
|
||||
- 类型: `Function`
|
||||
|
||||
代理原生事件的方法,便于事件的管理与销毁
|
||||
|
||||
<div className="run-code">▶ Run Code</div>
|
||||
|
||||
```js
|
||||
var container = document.querySelector('.artplayer-app');
|
||||
var art = new Artplayer({
|
||||
container: container,
|
||||
url: '/assets/sample/video.mp4',
|
||||
});
|
||||
|
||||
art.proxy(container, 'click', (event) => {
|
||||
console.info(event);
|
||||
});
|
||||
```
|
||||
|
||||
## storage
|
||||
|
||||
- 类型: `Object`
|
||||
|
||||
@@ -12,6 +12,7 @@ export default class Events {
|
||||
this.proxy = this.proxy.bind(this);
|
||||
this.hover = this.hover.bind(this);
|
||||
this.loadImg = this.loadImg.bind(this);
|
||||
art.proxy = this.proxy;
|
||||
|
||||
if (art.whitelist.state) {
|
||||
art.once('ready', () => {
|
||||
|
||||
+1
@@ -189,6 +189,7 @@ declare class Artplayer extends Player {
|
||||
emit(name: string): void;
|
||||
off(name: string, callback?: Function): void;
|
||||
query(selector: string): HTMLElement;
|
||||
proxy(target: HTMLElement, name: string, callback: Function, option?: object): Function;
|
||||
destroy(removeHtml?: boolean): void;
|
||||
|
||||
readonly template: {
|
||||
|
||||
Reference in new issue
Block a user