Remove Cash dependency, refactor event registration
(cherry picked from commit 8cd9a2ddeb)
			
			
This commit is contained in:
		
							parent
							
								
									ac12a9c55d
								
							
						
					
					
						commit
						214910aa25
					
				
							
								
								
									
										6
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										6
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @ -8,7 +8,6 @@ | ||||
|       "name": "wowtoken.app", | ||||
|       "version": "1.0.0", | ||||
|       "dependencies": { | ||||
|         "cash-dom": "^8.1.5", | ||||
|         "chart.js": "^4.4.0", | ||||
|         "chartjs-adapter-dayjs-3": "^1.2.3", | ||||
|         "css-minimizer-webpack-plugin": "^5.0.0", | ||||
| @ -543,11 +542,6 @@ | ||||
|         } | ||||
|       ] | ||||
|     }, | ||||
|     "node_modules/cash-dom": { | ||||
|       "version": "8.1.5", | ||||
|       "resolved": "https://registry.npmjs.org/cash-dom/-/cash-dom-8.1.5.tgz", | ||||
|       "integrity": "sha512-/BS05CfzyHR5xT2ksKj1sDLPaOv5rSmIwoGxNgdKwUtnIuiJ5neMxVEmZxvfyJiSjGbOMD0Lwe+9v+fszDqHew==" | ||||
|     }, | ||||
|     "node_modules/chalk": { | ||||
|       "version": "4.1.2", | ||||
|       "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", | ||||
|  | ||||
| @ -15,7 +15,6 @@ | ||||
|     "webpack-cli": "^4.7.2" | ||||
|   }, | ||||
|   "dependencies": { | ||||
|     "cash-dom": "^8.1.5", | ||||
|     "chart.js": "^4.4.0", | ||||
|     "chartjs-adapter-dayjs-3": "^1.2.3", | ||||
|     "css-minimizer-webpack-plugin": "^5.0.0", | ||||
|  | ||||
							
								
								
									
										31
									
								
								src/index.js
									
									
									
									
									
								
							
							
						
						
									
										31
									
								
								src/index.js
									
									
									
									
									
								
							| @ -9,7 +9,6 @@ import { | ||||
|     Title, | ||||
|     Tooltip | ||||
| } from 'chart.js'; | ||||
| import $ from 'cash-dom'; | ||||
| import 'chartjs-adapter-dayjs-3'; | ||||
| import "./style.css" | ||||
| 
 | ||||
| @ -195,7 +194,7 @@ async function pullChartData() { | ||||
| } | ||||
| 
 | ||||
| function formatToken() { | ||||
|     $("#token").html(currentPriceHash[currentRegionSelection].toLocaleString()); | ||||
|     document.getElementById("token").innerText = currentPriceHash[currentRegionSelection].toLocaleString(); | ||||
| } | ||||
| 
 | ||||
| // TODO: These maybe able to be collapsed into a single function with params or a lambda
 | ||||
| @ -293,7 +292,21 @@ function toolTipMouseOut() { | ||||
|     tooltip.innerHTML = "Copy to clipboard"; | ||||
| } | ||||
| 
 | ||||
| $(document).ready(function() { | ||||
| function registerEventHandles() { | ||||
|     registerCopyHandlers(); | ||||
|     registerOptionHandlers(); | ||||
| } | ||||
| 
 | ||||
| function registerCopyHandlers() { | ||||
|     document.getElementById('copyURLButton').addEventListener('click', function (event) { | ||||
|         copyURL(); | ||||
|     }) | ||||
|     document.getElementById('copyURLButton').addEventListener('mouseout', function (event) { | ||||
|         toolTipMouseOut(); | ||||
|     }) | ||||
| } | ||||
| 
 | ||||
| function registerOptionHandlers() { | ||||
|     document.getElementById('region').addEventListener('change', function() { | ||||
|         updateRegionPreference(this.value); | ||||
|     }); | ||||
| @ -305,15 +318,13 @@ $(document).ready(function() { | ||||
|     document.getElementById('aggregate').addEventListener('change', function () { | ||||
|         updateAggregatePreference(this.value); | ||||
|     }) | ||||
|     document.getElementById('copyURLButton').addEventListener('click', function (event) { | ||||
|         copyURL(); | ||||
|     }) | ||||
|     document.getElementById('copyURLButton').addEventListener('mouseout', function (event) { | ||||
|         toolTipMouseOut(); | ||||
|     }) | ||||
|     currentAggregateSelection = document.getElementById('aggregate').value; | ||||
| } | ||||
| 
 | ||||
| document.addEventListener('DOMContentLoaded', function () { | ||||
|     registerEventHandles(); | ||||
|     detectURLQuery(); | ||||
|     Promise.all([callUpdateURL(), pullChartData()]).then(populateChart) | ||||
|     setInterval(callUpdateURL, 60*1000); | ||||
| }); | ||||
| }, false); | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user