Skip to content

Commit 152cd02

Browse files
committed
Fixed #1 - Calling API methods by passing a string to the plugin constructor method
1 parent 997f7f4 commit 152cd02

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/jqfactory.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@
6868
};
6969
}
7070
setup = function() {
71-
var firstArg = arguments[0],
71+
var args = slice.call(arguments),
72+
firstArg = args[0],
7273
options = $.isPlainObject(firstArg) ? firstArg : {},
7374
existingElem = props.element,
7475
callingElement = this,
@@ -82,7 +83,10 @@
8283
rendered;
8384
if (existingInstance) {
8485
existingInstance._init.apply(existingInstance, arguments);
85-
existingInstance._superMethod.apply(existingInstance, arguments);
86+
if($.type(firstArg) === 'string') {
87+
args.shift();
88+
existingInstance[firstArg].apply(existingInstance, args);
89+
}
8690
return;
8791
}
8892
widget = new Plugin(instanceProps);

src/jqfactory.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)