Skip to content

Commit

Permalink
Merge pull request #12 from iris-web-lab/library-implement
Browse files Browse the repository at this point in the history
Library implement math.js
  • Loading branch information
samolukadjo authored Jan 14, 2024
2 parents e0f3ec7 + 7a3a213 commit b3b14f6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
7 changes: 4 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<meta name="theme-color" content="#004A77" />
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="manifest" href="/manifest.json?ver=13" />
<link rel="stylesheet" href="style.css?ver=13">
<link rel="manifest" href="/manifest.json?ver=14" />
<link rel="stylesheet" href="style.css?ver=14">
<link rel="icon" type="image/x-icon" href="/favicon.ico">
<style>
@font-face {
Expand Down Expand Up @@ -57,6 +57,7 @@
<div id="button-equal" class="button equal">=</div>
</div>
</div>
<script src="/script.js?ver=13"></script>
<script src="/script.js?ver=14"></script>
<script src="https://unpkg.com/[email protected]/lib/browser/math.js"></script>
</body>
</html>
6 changes: 3 additions & 3 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"short_name": "Calculator",
"display_override": ["window-controls-overlay"],
"display": "standalone",
"version": "13.0",
"version_name": "13 realese",
"version": "14.0",
"version_name": "14 realese",
"categories": ["productivity", "utilities"],
"description": "A simple and modern calculator PWA web app.",
"start_url": "/index.html?ver=13",
"start_url": "/index.html?ver=14",
"theme_color": "#004A77",
"background_color": "#000",
"scope": "/",
Expand Down
8 changes: 4 additions & 4 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
navigator.serviceWorker && navigator.serviceWorker.register('/sw.js?ver=13').then(function (registration) {
navigator.serviceWorker && navigator.serviceWorker.register('/sw.js?ver=14').then(function (registration) {
console.log('Excellent, registered with scope: ', registration.scope);
});

Expand All @@ -8,7 +8,7 @@ const buttonClear = document.getElementById("button-clear");
const buttonEqual = document.getElementById("button-equal");
let errSetting = 0;
let counter = 0;
const version = 13;
const version = 14;

buttons.forEach(item => {
let val = item.dataset.purpose;
Expand Down Expand Up @@ -59,8 +59,8 @@ function clearDisplay() {
function evaluateDisplay() {
try {
//let result = eval(display.textContent);
let result = new Function("return " + display.textContent);
display.textContent = result();
//let result = new Function("return " + display.textContent);
display.textContent = math.evaluate(display.textContent);
} catch (error) {
if (errSetting == 0) {
display.textContent = "Error";
Expand Down
5 changes: 3 additions & 2 deletions sw.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Choose a cache name
const cacheName = 'cache-v13';
const version = 13;
const cacheName = 'cache-v14';
const version = 14;
// List the files to precache
const precacheResources = [
'/',
Expand All @@ -13,6 +13,7 @@ const precacheResources = [
'/icon-192.png',
'/icon-512-maskable.png',
'/back.svg',
'https://unpkg.com/[email protected]/lib/browser/math.js',
];

addEventListener("install", (event) => {
Expand Down

0 comments on commit b3b14f6

Please sign in to comment.