From a641ed46d172ab144e462ec0e77a8d72708e3b45 Mon Sep 17 00:00:00 2001 From: Rudolf Meijering Date: Tue, 26 Nov 2019 20:49:55 +0100 Subject: [PATCH] Expose 'rxjs/ajax' to sandbox --- lib/observable-from-code.js | 4 +++- lib/observable-from-code.test.js | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) 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')`); +});