From fd22cf24a7fcd696138ab7242aae1f7bc6d86281 Mon Sep 17 00:00:00 2001 From: David Seifried Date: Wed, 21 Sep 2011 15:49:42 -0400 Subject: [PATCH] Added support for in and out to be used instead of start and end's definition within the plugin --- popcorn.js | 4 ++++ test/popcorn.unit.js | 9 +++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/popcorn.js b/popcorn.js index 8c04fb2..6eebe50 100644 --- a/popcorn.js +++ b/popcorn.js @@ -1207,6 +1207,10 @@ options._natives.type = name; options._running = false; + natives[ "in" ] && ( natives.start = natives[ "in" ] ); + + natives[ "out" ] && ( natives.end = natives[ "out" ] ); + // Check for previously set default options defaults = this.options.defaults && this.options.defaults[ options._natives && options._natives.type ]; diff --git a/test/popcorn.unit.js b/test/popcorn.unit.js index d36bc08..d2c6acd 100644 --- a/test/popcorn.unit.js +++ b/test/popcorn.unit.js @@ -2598,10 +2598,10 @@ test( "In/Out aliases", function() { Popcorn.plugin( "aliasTester", function() { return { - start: function() { + in: function() { counter++; }, - end: function() { + out: function() { counter++; } }; @@ -2614,6 +2614,11 @@ test( "In/Out aliases", function() { popcorn.currentTime( 0 ).pause(); + ok( popcorn.data.events[ "in" ], "in is a valid alias for start" ); + plus(); + + ok( popcorn.data.events[ "out" ], "out is a valid alias for end" ); + equals( counter, 0, "Counter is at 0, neither in or out have been called" ); plus(); -- 2.43.0