(cm, f)
| 5529 | } |
| 5530 | // Wraps a function in an operation. Returns the wrapped function. |
| 5531 | function operation(cm, f) { |
| 5532 | return function () { |
| 5533 | if (cm.curOp) { |
| 5534 | return f.apply(cm, arguments) |
| 5535 | } |
| 5536 | startOperation(cm) |
| 5537 | try { |
| 5538 | return f.apply(cm, arguments) |
| 5539 | } finally { |
| 5540 | endOperation(cm) |
| 5541 | } |
| 5542 | } |
| 5543 | } |
| 5544 | // Used to add methods to editor and doc instances, wrapping them in |
| 5545 | // operations. |
| 5546 | function methodOp(f) { |
no test coverage detected