FIX: Register a test waiter rather than using hidden properties
This commit is contained in:
parent
40c944cb36
commit
0348f23f6d
|
@ -36,6 +36,7 @@ export default Ember.Component.extend({
|
||||||
|
|
||||||
loadScript("/javascripts/ace/ace.js", { scriptTag: true }).then(() => {
|
loadScript("/javascripts/ace/ace.js", { scriptTag: true }).then(() => {
|
||||||
window.ace.require(['ace/ace'], loadedAce => {
|
window.ace.require(['ace/ace'], loadedAce => {
|
||||||
|
if (!this.element || this.isDestroying || this.isDestroyed) { return; }
|
||||||
const editor = loadedAce.edit(this.$('.ace')[0]);
|
const editor = loadedAce.edit(this.$('.ace')[0]);
|
||||||
|
|
||||||
editor.setTheme("ace/theme/chrome");
|
editor.setTheme("ace/theme/chrome");
|
||||||
|
|
|
@ -5,13 +5,16 @@ const _loading = {};
|
||||||
function loadWithTag(path, cb) {
|
function loadWithTag(path, cb) {
|
||||||
const head = document.getElementsByTagName('head')[0];
|
const head = document.getElementsByTagName('head')[0];
|
||||||
|
|
||||||
|
let finished = false;
|
||||||
let s = document.createElement('script');
|
let s = document.createElement('script');
|
||||||
s.src = path;
|
s.src = path;
|
||||||
if (Ember.Test) { Ember.Test.pendingAjaxRequests++; }
|
if (Ember.Test) {
|
||||||
|
Ember.Test.registerWaiter(() => finished);
|
||||||
|
}
|
||||||
head.appendChild(s);
|
head.appendChild(s);
|
||||||
|
|
||||||
s.onload = s.onreadystatechange = function(_, abort) {
|
s.onload = s.onreadystatechange = function(_, abort) {
|
||||||
if (Ember.Test) { Ember.Test.pendingAjaxRequests--; }
|
finished = true;
|
||||||
if (abort || !s.readyState || s.readyState === "loaded" || s.readyState === "complete") {
|
if (abort || !s.readyState || s.readyState === "loaded" || s.readyState === "complete") {
|
||||||
s = s.onload = s.onreadystatechange = null;
|
s = s.onload = s.onreadystatechange = null;
|
||||||
if (!abort) {
|
if (!abort) {
|
||||||
|
|
Loading…
Reference in New Issue