@clappr/core
Advanced tools
Comparing version 0.4.19 to 0.4.20
{ | ||
"name": "@clappr/core", | ||
"version": "0.4.19", | ||
"version": "0.4.20", | ||
"description": "Core components of the extensible media player for the web", | ||
@@ -5,0 +5,0 @@ "main": "./dist/clappr-core.js", |
@@ -134,2 +134,3 @@ // Copyright 2014 Globo.com Player authors. All rights reserved. | ||
this.clickDelay = 200 // FIXME: could be a player option | ||
this.actionsMetadata = {} | ||
this.bindEvents() | ||
@@ -301,15 +302,24 @@ } | ||
playing() { | ||
this.trigger(Events.CONTAINER_PLAY, this.name) | ||
this.trigger(Events.CONTAINER_PLAY, this.name, this.actionsMetadata.playEvent || {}) | ||
this.actionsMetadata.playEvent = {} | ||
} | ||
paused() { | ||
this.trigger(Events.CONTAINER_PAUSE, this.name) | ||
this.trigger(Events.CONTAINER_PAUSE, this.name, this.actionsMetadata.pauseEvent || {}) | ||
this.actionsMetadata.pauseEvent = {} | ||
} | ||
stopped() { | ||
this.trigger(Events.CONTAINER_STOP, this.actionsMetadata.stopEvent || {}) | ||
this.actionsMetadata.stopEvent = {} | ||
} | ||
/** | ||
* plays the playback | ||
* @method play | ||
* @param {Object} customData | ||
*/ | ||
play() { | ||
this.playback.play() | ||
play(customData = {}) { | ||
this.actionsMetadata.playEvent = customData | ||
this.playback.play(customData) | ||
} | ||
@@ -320,5 +330,7 @@ | ||
* @method stop | ||
* @param {Object} customData | ||
*/ | ||
stop() { | ||
this.playback.stop() | ||
stop(customData = {}) { | ||
this.actionsMetadata.stopEvent = customData | ||
this.playback.stop(customData) | ||
this.currentTime = 0 | ||
@@ -330,5 +342,7 @@ } | ||
* @method pause | ||
* @param {Object} customData | ||
*/ | ||
pause() { | ||
this.playback.pause() | ||
pause(customData = {}) { | ||
this.actionsMetadata.pauseEvent = customData | ||
this.playback.pause(customData) | ||
} | ||
@@ -341,6 +355,2 @@ | ||
stopped() { | ||
this.trigger(Events.CONTAINER_STOP) | ||
} | ||
clicked() { | ||
@@ -347,0 +357,0 @@ if (!this.options.chromeless || this.options.allowUserInteraction) { |
@@ -187,2 +187,54 @@ import Container from './container' | ||
test('trigger container:pause with no parameters', () => { | ||
jest.spyOn(this.container, 'trigger') | ||
this.container.pause() | ||
this.playback.trigger(Events.PLAYBACK_PAUSE) | ||
expect(this.container.trigger).toHaveBeenCalledWith(Events.CONTAINER_PAUSE, this.container.name, {}) | ||
}) | ||
test('trigger container:pause with parameters', () => { | ||
jest.spyOn(this.container, 'trigger') | ||
const parameter = { anyParameter: 'parameter' } | ||
this.container.pause(parameter) | ||
this.playback.trigger(Events.PLAYBACK_PAUSE) | ||
expect(this.container.trigger).toHaveBeenCalledWith(Events.CONTAINER_PAUSE, this.container.name, parameter) | ||
}) | ||
test('trigger container:play with no parameters', () => { | ||
jest.spyOn(this.container, 'trigger') | ||
this.container.pause() | ||
this.playback.trigger(Events.PLAYBACK_PLAY) | ||
expect(this.container.trigger).toHaveBeenCalledWith(Events.CONTAINER_PLAY, this.container.name, {}) | ||
}) | ||
test('trigger container:play with parameters', () => { | ||
jest.spyOn(this.container, 'trigger') | ||
const parameter = { anyParameter: 'parameter' } | ||
this.container.play(parameter) | ||
this.playback.trigger(Events.PLAYBACK_PLAY) | ||
expect(this.container.trigger).toHaveBeenCalledWith(Events.CONTAINER_PLAY, this.container.name, parameter) | ||
}) | ||
test('trigger container:stop with no parameters', () => { | ||
jest.spyOn(this.container, 'trigger') | ||
this.container.stop() | ||
this.playback.trigger(Events.PLAYBACK_STOP) | ||
expect(this.container.trigger).toHaveBeenCalledWith(Events.CONTAINER_STOP, {}) | ||
}) | ||
test('trigger container:stop with parameters', () => { | ||
jest.spyOn(this.container, 'trigger') | ||
const parameter = { anyParameter: 'parameter' } | ||
this.container.stop(parameter) | ||
this.playback.trigger(Events.PLAYBACK_STOP) | ||
expect(this.container.trigger).toHaveBeenCalledWith(Events.CONTAINER_STOP, parameter) | ||
}) | ||
describe('#checkResize', () => { | ||
@@ -189,0 +241,0 @@ beforeEach(() => { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
1904688
25763
1