Load iFrame on page load
This commit is contained in:
@@ -3,7 +3,7 @@ window.common = (function(global) {
|
||||
// all classes should be stored here
|
||||
// called at the beginning of dom ready
|
||||
const {
|
||||
Rx: { config },
|
||||
Rx: { Disposable, Observable, config },
|
||||
common = { init: [] }
|
||||
} = global;
|
||||
|
||||
@@ -86,5 +86,21 @@ window.common = (function(global) {
|
||||
return code.replace(regexp, text);
|
||||
};
|
||||
|
||||
common.getScriptContent$ = function getScriptContent$(script) {
|
||||
return Observable.create(function(observer) {
|
||||
const jqXHR = $.get(script)
|
||||
.success(data => {
|
||||
observer.onNext(data);
|
||||
observer.onCompleted();
|
||||
})
|
||||
.fail(e => observer.onError(e))
|
||||
.always(() => observer.onCompleted());
|
||||
|
||||
return new Disposable(() => {
|
||||
jqXHR.abort();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
return common;
|
||||
})(window);
|
||||
|
Reference in New Issue
Block a user