diff --git a/lib/observable-from-code.js b/lib/observable-from-code.js index 4130573..c6583ed 100644 --- a/lib/observable-from-code.js +++ b/lib/observable-from-code.js @@ -1,5 +1,6 @@ import * as Rx from 'rxjs'; import * as RxOperators from 'rxjs/operators'; +import * as RxAjax from 'rxjs/ajax'; const evalInContext = (code, context) => { const scope = Object.keys(context) @@ -21,7 +22,8 @@ export const getObservableFromCode = (code, context) => { observable$ = evalInContext(code, { ...context, Rx, - RxOperators + RxOperators, + RxAjax }); } catch (e) { return { diff --git a/lib/observable-from-code.test.js b/lib/observable-from-code.test.js index fb848a2..39f3e18 100644 --- a/lib/observable-from-code.test.js +++ b/lib/observable-from-code.test.js @@ -49,3 +49,7 @@ it('handles multiple statements', () => { ` ); }); + +it('handles an Observable created with rxjs/ajax', () => { + expectObservable(`RxAjax.ajax.getJSON('https://api.github.com/users')`); +});