(cm, f)
| 3178 | } |
| 3179 | // Wraps a function in an operation. Returns the wrapped function. |
| 3180 | function operation(cm, f) { |
| 3181 | return function() { |
| 3182 | if (cm.curOp) return f.apply(cm, arguments); |
| 3183 | startOperation(cm); |
| 3184 | try { return f.apply(cm, arguments); } |
| 3185 | finally { endOperation(cm); } |
| 3186 | }; |
| 3187 | } |
| 3188 | // Used to add methods to editor and doc instances, wrapping them in |
| 3189 | // operations. |
| 3190 | function methodOp(f) { |
no test coverage detected