(cm, f)
| 3199 | } |
| 3200 | // Wraps a function in an operation. Returns the wrapped function. |
| 3201 | function operation(cm, f) { |
| 3202 | return function() { |
| 3203 | if (cm.curOp) return f.apply(cm, arguments); |
| 3204 | startOperation(cm); |
| 3205 | try { return f.apply(cm, arguments); } |
| 3206 | finally { endOperation(cm); } |
| 3207 | }; |
| 3208 | } |
| 3209 | // Used to add methods to editor and doc instances, wrapping them in |
| 3210 | // operations. |
| 3211 | function methodOp(f) { |
no test coverage detected