From 1472405c0155e2f6cdd188515e460f77db2d4e77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Grzegorz=20Ku=C4=87mierz?= Date: Thu, 17 Nov 2022 02:52:08 +0100 Subject: [PATCH] move initial code to config --- src/app.config.mjs | 12 ++++++++++++ src/views/HomeView.vue | 15 ++------------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/app.config.mjs b/src/app.config.mjs index 530b27b..831db25 100644 --- a/src/app.config.mjs +++ b/src/app.config.mjs @@ -1,3 +1,15 @@ export const MAX_DATA_SIZE = 1e5; export const ERROR_MAX_DATA_SIZE = 'Error: Output exceeded maximum size allowed'; +export const WELCOME_CODE = ` +'Hello World!'; + +new Array(10).fill(0).map((_, i) => '#'.repeat(i+1)); + +2n ** 42n; + +for (let i = 0; i < 42; ++i) { + console.log(i); +} + +`; diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index 00e1d1a..947902f 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -2,6 +2,7 @@ import Result from '../components/Result.vue'; import Code from '../components/Code.vue'; +import { WELCOME_CODE } from '../app.config'; import Worker from '../file.worker.js?worker'; @@ -18,20 +19,8 @@ export default defineComponent({ Result, Code, }, data() { - const code = ` -'Hello World!'; - -new Array(10).fill(0).map((_, i) => '#'.repeat(i+1)); - -2n ** 42n; - -for (let i = 0; i < 42; ++i) { - console.log(i); -} - -`; return { - code: { value: code }, + code: { value: WELCOME_CODE }, worker: null, result: '', }