From 1f66794a13b8e301d8c81b7b0f58d069216ad7b5 Mon Sep 17 00:00:00 2001 From: Dave Artz Date: Wed, 27 Nov 2013 09:58:18 -0500 Subject: [PATCH] Add interface to extend default options. --- .../jquery.prototypal-inheritance.plugin-boilerplate.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/patterns/jquery.prototypal-inheritance.plugin-boilerplate.js b/patterns/jquery.prototypal-inheritance.plugin-boilerplate.js index 88b02e9..0768175 100644 --- a/patterns/jquery.prototypal-inheritance.plugin-boilerplate.js +++ b/patterns/jquery.prototypal-inheritance.plugin-boilerplate.js @@ -48,6 +48,12 @@ if ( typeof Object.create !== "function" ) { // Create a plugin based on a defined object $.plugin = function( name, object ) { + + // Interface to extend default options + $[name] = function (options) { + $.extend(object.options, options); + }; + $.fn[name] = function( options ) { return this.each(function() { if ( ! $.data( this, name ) ) {