Browse Source

Implement a timeout when executing a write command

Lucas de Souza 4 years ago
parent
commit
6bdad91ed6
3 changed files with 10 additions and 10 deletions
  1. 1 2
      i18n/index.js
  2. 8 6
      js/io/domConsole.js
  3. 1 2
      webpack.config.js

+ 1 - 2
i18n/index.js

@@ -1,6 +1,6 @@
 import Messages from './message.csv';
 import Messages from './message.csv';
 import UI from './ui.csv';
 import UI from './ui.csv';
-import Errors from './error.csv'
+import Errors from './error.csv';
 
 
 const i18n_data = {};
 const i18n_data = {};
 for(const key in UI) {
 for(const key in UI) {
@@ -10,6 +10,5 @@ for(const key in UI) {
   data['ui'] = UI[key];
   data['ui'] = UI[key];
   i18n_data[key] = data;
   i18n_data[key] = data;
 }
 }
-console.log(i18n_data["en"]);
 
 
 export default i18n_data;
 export default i18n_data;

+ 8 - 6
js/io/domConsole.js

@@ -182,12 +182,14 @@ export class DOMConsole {
   }
   }
 
 
   _appendText (text, type) {
   _appendText (text, type) {
-    const divClass = this.getClassForType(type);
-    const textDiv = document.createElement('div');
-    textDiv.classList.add(divClass);
-    textDiv.innerHTML = this.getOutputText(text);
-    this.termDiv.insertBefore(textDiv, this.inputDiv);
-    this.scrollTerm();
+    setTimeout(() => {
+      const divClass = this.getClassForType(type);
+      const textDiv = document.createElement('div');
+      textDiv.classList.add(divClass);
+      textDiv.innerHTML = this.getOutputText(text);
+      this.termDiv.insertBefore(textDiv, this.inputDiv);
+      this.scrollTerm();
+    }, 50)
   }
   }
 
 
   _appendUserInput (text) {
   _appendUserInput (text) {

+ 1 - 2
webpack.config.js

@@ -4,7 +4,6 @@ const UpdateVersionPlugin = require('./updateVersionPlugin');
 //const ChangeScriptSourcePlugin = require('./changeScriptSourcePlugin');
 //const ChangeScriptSourcePlugin = require('./changeScriptSourcePlugin');
 const CopyPlugin = require('copy-webpack-plugin');
 const CopyPlugin = require('copy-webpack-plugin');
 const CleanWebpackPlugin = require('clean-webpack-plugin');
 const CleanWebpackPlugin = require('clean-webpack-plugin');
-const CSVLoader = require("./i18n_csv_loader");
 
 
 module.exports = {
 module.exports = {
     entry: path.resolve(__dirname, 'js/main.js'),
     entry: path.resolve(__dirname, 'js/main.js'),
@@ -53,7 +52,7 @@ module.exports = {
         ]
         ]
     },
     },
     resolve: {
     resolve: {
-      extensions: [ '.tsx', '.ts', '.js' ]
+      extensions: [ '.tsx', '.ts', '.js', '.csv' ]
     },
     },
     stats: {
     stats: {
         colors: true
         colors: true