Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

[#1156] create track event _id before setup is called, still allow user ... #104

Merged
merged 1 commit into from

2 participants

@ScottDowne
Owner

...defined ids, and still support addTrackEvent called outside of a plugin, in the case of internal padding plugins.

@ScottDowne ScottDowne [#1156] create track event _id before setup is called, still allow us…
…er defined ids, and still support addTrackEvent called outside of a plugin, in the case of internal padding plugins.
d4ab4d4
@jbuck jbuck merged commit 84fdf64 into mozilla:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 15, 2012
  1. @ScottDowne

    [#1156] create track event _id before setup is called, still allow us…

    ScottDowne authored
    …er defined ids, and still support addTrackEvent called outside of a plugin, in the case of internal padding plugins.
This page is out of date. Refresh to see the latest.
Showing with 23 additions and 1 deletion.
  1. +6 −1 popcorn.js
  2. +17 −0 test/popcorn.unit.js
View
7 popcorn.js
@@ -860,7 +860,7 @@
if ( track._natives ) {
// Supports user defined track event id
- track._id = !track.id ? Popcorn.guid( track._natives.type ) : track.id;
+ track._id = track.id || track._id || Popcorn.guid( track._natives.type );
// Push track event ids into the history
obj.data.history.push( track._id );
@@ -1466,6 +1466,11 @@
options.target = manifestOpts && "target" in manifestOpts && manifestOpts.target;
}
+ if ( options._natives ) {
+ // ensure an initial id is there before setup is called
+ options._id = Popcorn.guid( options._natives.type );
+ }
+
// Trigger _setup method if exists
options._natives._setup && options._natives._setup.call( this, options );
View
17 test/popcorn.unit.js
@@ -1830,6 +1830,23 @@ test( "UI/Mouse", function() {
});
module( "Popcorn Plugin" );
+
+test( "Plugin _id applied before setup", function() {
+
+ expect( 1 );
+
+ var p = Popcorn( "#video" );
+
+ Popcorn.plugin( "idPlugin", {
+ _setup: function( options ) {
+ ok( options._id, "_id was set before setup" );
+ Popcorn.removePlugin( "idPlugin" );
+ }
+ });
+
+ p.idPlugin({});
+});
+
test( "Manifest", function() {
var p = Popcorn( "#video" ),
Something went wrong with that request. Please try again.