Skip to content

Instantly share code, notes, and snippets.

@cadecairos
Created December 3, 2012 17:27
Show Gist options
  • Save cadecairos/4196537 to your computer and use it in GitHub Desktop.
Save cadecairos/4196537 to your computer and use it in GitHub Desktop.
Popcorn.plugin( "foo", function() {
return {
_setup: function( options ) {
options.toString = function() {
console.log( options.text )
};
},
_update: function( trackEvent, options ) {
trackEvent.text = options.text;
}
};
});
popcornInstance.foo( "foo123", { text: "foo" } );
var event = popcornInstance.getTrackEvent( "foo123" );
event.toString();
// logs `foo`
popcornInstance.foo( "foo123", { text: "bar" } );
event = popcornInstance.getTrackEvent( "foo123" );
event.toString();
// logs `foo`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment