Skip to content

Commit e16d014

Browse files
authored
Add fib.js to minified-with-source-maps
2 parents 0db4b98 + cd1c20a commit e16d014

File tree

5 files changed

+30
-5
lines changed

5 files changed

+30
-5
lines changed

minified-with-source-maps/app.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { h, render } from 'preact';
22
import { useEffect, useRef, useState } from 'preact/hooks';
33
import { loadImage } from './load.js';
4+
import './fib.js';
45

56
const app = h(MyApp, null, '');
67

minified-with-source-maps/bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

minified-with-source-maps/bundle.js.map

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

minified-with-source-maps/fib.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
function fibonacci(num) {
2+
if (num <= 1) return 1;
3+
4+
return fibonacci(num - 1) + fibonacci(num - 2);
5+
}
6+
7+
const btn = document.querySelector('button');
8+
const params = new URLSearchParams(location.search);
9+
10+
btn.addEventListener('click', () => {
11+
console.log(fibonacci(Number(params.get('x'))));
12+
btn.style.backgroundColor = 'red';
13+
});
14+
15+
const input = document.querySelector('input[type="text"]');
16+
input.addEventListener('input', () => {
17+
console.log(fibonacci(Number(params.get('x'))));
18+
});

minified-with-source-maps/index.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@
2727
</p>
2828
<p>This bundle is made up of <code>Preact</code> alongside some source code. It's all bundled into <code>bundle.js</code> but it ships a sourcemap.</p>
2929
</div>
30+
31+
<div>
32+
<button>Click me</button>
33+
<input placeholder="type in here to trigger fibonacci" type="text" />
34+
</div>
35+
3036
<script src="bundle.js"></script>
3137
</body>
3238
</html>

0 commit comments

Comments
 (0)