Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onEditationChange(val, old) {
if (val) {
// focus textarea and set height
this.height = (this.$refs.div as HTMLElement).clientHeight;
Vue.nextTick(() => {
(this.$refs.textarea as HTMLElement).focus();
});
} else {
// texteare unfocused, set height of div
this.height = (this.$refs.textarea as HTMLElement).clientHeight;
}
}
}
public async onActivate() {
const scene = new ThreeScene();
scene.name = this.name;
this.m_scene.set(scene);
this.m_active = true;
await Vue.nextTick();
this.$emit("loaded");
}
public async onUnload() {
resize() {
Vue.nextTick(() => {
const RATIO = 1.7
const reference = document.querySelector(LeekWars.flex ? '.app-center' : '.app-wrapper') as HTMLElement
const offset = LeekWars.flex ? 40 + 24 : 24
if (reference) {
if (!LeekWars.mobile) {
const height = Math.min(window.innerHeight - 128, Math.round((reference.offsetWidth - offset) / RATIO))
this.playerWidth = Math.round(height * RATIO)
this.playerHeight = height
} else {
this.playerWidth = window.innerWidth
this.playerHeight = this.playerWidth / RATIO
}
}
})
}
public selectHint(index: number) {
this.selectedCompletion = index
this.selectedHint = this.hints[index]
Vue.nextTick(() => {
const hints = this.$refs.hints as HTMLElement
const hintList = (this.$refs.hintDialog as HTMLElement).querySelectorAll('.hint') as any
const posIndex = Math.max(0, Math.round(index - (hints.offsetHeight / hintList[index].offsetHeight) / 2 + 1))
if (hintList[posIndex]) {
hints.scrollTo(0, -2 + hintList[posIndex].offsetTop)
}
})
}
public pick() {
openNewFolder() {
this.newFolderName = ''
this.newFolderDialog = true
Vue.nextTick(() => {
(this.$refs.newFolderInput as HTMLElement).focus()
})
}
newAI(v2: boolean, name: string) {
jump(ai: AI, line: number) {
if (ai !== this.currentAI) {
this.$router.push('/editor/' + ai.id)
}
Vue.nextTick(() => {
const editor = (this.$refs.editors as AIView[]).find(e => e.ai === ai)
if (editor) { editor.scrollToLine(line - 1) }
})
}
load(ai: AI) {
private async onUnload(): Promise {
this.m_active = false;
await Vue.nextTick();
}
private async onLoad(): Promise {
this.m_active = true;
const bundles = this.getBundles(this.dependencies);
const deps = this.m_bundle.registerDependencies(bundles);
await Vue.nextTick();
await deps;
}
openNewAI(v2: boolean) {
this.newAIName = ''
if (v2) {
this.newAIv2Dialog = true
Vue.nextTick(() => {
(this.$refs.newAIInputv2 as HTMLElement).focus()
})
} else {
this.newAIDialog = true
Vue.nextTick(() => {
(this.$refs.newAIInput as HTMLElement).focus()
})
}
}
openNewFolder() {
private async mounted() {
await Vue.nextTick()
window.addEventListener('online', this.dispatchUpdateNetworkState)
window.addEventListener('offline', this.dispatchUpdateNetworkState)
this.taskRunnerInterval = setInterval(() => {
this.$store.dispatch('runTasks')
}, 50)
await this.$store.dispatch('init')
}