(cm, f)
| 1961 | } |
| 1962 | // Wraps a function in an operation. Returns the wrapped function. |
| 1963 | function operation(cm, f) { |
| 1964 | return function() { |
| 1965 | if (cm.curOp) return f.apply(cm, arguments); |
| 1966 | startOperation(cm); |
| 1967 | try { return f.apply(cm, arguments); } |
| 1968 | finally { endOperation(cm); } |
| 1969 | }; |
| 1970 | } |
| 1971 | // Used to add methods to editor and doc instances, wrapping them in |
| 1972 | // operations. |
| 1973 | function methodOp(f) { |
no test coverage detected