(cm1, f)
| 1435 | |
| 1436 | // Wraps a function in an operation. Returns the wrapped function. |
| 1437 | function operation(cm1, f) { |
| 1438 | return function() { |
| 1439 | var cm = cm1 || this, withOp = !cm.curOp; |
| 1440 | if (withOp) startOperation(cm); |
| 1441 | try { var result = f.apply(cm, arguments); } |
| 1442 | finally { if (withOp) endOperation(cm); } |
| 1443 | return result; |
| 1444 | }; |
| 1445 | } |
| 1446 | function docOperation(f) { |
| 1447 | return function() { |
| 1448 | var withOp = this.cm && !this.cm.curOp, result; |
no test coverage detected