Skip to content

Commit f0a17f3

Browse files
Ruud-cbRuud-cb
Ruud-cb
authored and
Ruud-cb
committed
on promise reject accept string or an normal menu item object.
1 parent 4464e03 commit f0a17f3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/jquery.contextMenu.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1442,12 +1442,14 @@
14421442
};
14431443
function errorPromise(opt,root,errorItem) {
14441444
//user called promise.reject() with an error item, if not, provide own error item.
1445-
if ( typeof errorItem === 'string' || errorItem === undefined) {
1445+
if (errorItem === undefined) {
14461446
errorItem = { "error": { name: "No items and no error item", icon: "context-menu-icon context-menu-icon-quit" } };
14471447
if (window.console) {
14481448
(console.error || console.log).call(console, 'When you reject a promise, provide an "items" object, equal to normal sub-menu items');
14491449
}
1450-
}
1450+
}else if(typeof errorItem === 'string'){
1451+
errorItem = { "error": { name: errorItem } };
1452+
}
14511453
finishPromiseProcess(opt,root,errorItem);
14521454
};
14531455
function finishPromiseProcess(opt,root,items) {

0 commit comments

Comments
 (0)