Skip to content

Commit a237d60

Browse files
committed
Dialogs: You can now pass your own constructor to createDialog (#304)
1 parent 6ff6006 commit a237d60

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/client/javascript/api.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1127,6 +1127,8 @@
11271127
/**
11281128
* Create a new dialog
11291129
*
1130+
* You can also pass a function as `className` to return an instance of your own class
1131+
*
11301132
* @param String className Dialog Namespace Class Name
11311133
* @param Object args Arguments you want to send to dialog
11321134
* @param Function callback Callback on dialog action (close/ok etc) => fn(ev, button, result)
@@ -1154,7 +1156,7 @@
11541156
callback.apply(null, arguments);
11551157
}
11561158

1157-
var win = new OSjs.Dialogs[className](args, cb);
1159+
var win = typeof className === 'string' ? new OSjs.Dialogs[className](args, cb) : className(args, cb);
11581160

11591161
if ( !parentObj ) {
11601162
var wm = OSjs.Core.getWindowManager();

0 commit comments

Comments
 (0)