Browse Source

feat: added functions to delete all variables and operations

Marcelo Vilas Boas Correa Filho 3 years ago
parent
commit
bca68edf9d

+ 9 - 0
js/accessibleUI/modules/operations/operations.js

@@ -226,6 +226,15 @@ export function deleteOperation (hash) {
     operations.splice(operations.indexOf(operation), 1);
 }
 
+// Here we remove all operation
+export function deleteAllOperation () {
+    for (let i = 0; i < operations.length; i++) {
+        document.getElementById(`operation${operations[i].hash}Li`).remove();
+    }
+
+    operations.length = 0;
+}
+
 // ***********************************************************************
 // Util
 // ***********************************************************************

+ 9 - 0
js/accessibleUI/modules/variables/variables.js

@@ -97,6 +97,15 @@ export function deleteVariable (hash) {
     variables.splice(variables.indexOf(variable), 1);
 }
 
+// Deleting all variable
+export function deleteAllVariable () {
+    for (let i = 0; i < variables.length; i++) {
+        document.getElementById(`variable${variables[i].hash}Li`).remove();
+    }
+
+    variables.length = 0
+}
+
 // *********************************************************************************
 // Util
 // *********************************************************************************