Skip to content

Commit 8a0fbb3

Browse files
committed
Add a section on app varieties
1 parent 6bef39f commit 8a0fbb3

18 files changed

Lines changed: 9873 additions & 2751 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# No Preview
2+
3+
👨‍💼 Some apps don't have a `dev` script in the `package.json` because they don't
4+
actually run and you're instead expected to run the app manually.
5+
6+
You'll notice we also don't have a preview for the problem and solution either
7+
for the same reason, so those tabs won't appear.
8+
9+
Incidentally, this exercise also does not have a `test` script so there is no
10+
Test tab either.
11+
12+
🐨 Open a terminal into the `./playground` directory and run `node greet.js` to
13+
see what it outputs.
14+
15+
🐨 Continue to the solution for this step.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
function greet(name) {
2+
// 🐨 change this to "Yo" instead of "Hello"
3+
return `Hello, ${name}!`
4+
}
5+
6+
console.log(greet('John'))
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "exercises_02.app-varieties_01.problem.no-preview",
3+
"type": "module"
4+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# No Preview
2+
3+
👨‍💼 In some workshops (especially testing workshops) you'll be expected to run
4+
scripts manually (like you would in practice) which is why there's no preview
5+
for this type of app.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
function greet(name) {
2+
// 🐨 change this to "Yo" instead of "Hello"
3+
return `Hello, ${name}!`
4+
}
5+
6+
console.log(greet('John'))
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "exercises_02.app-varieties_01.solution.no-preview",
3+
"type": "module"
4+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Simple Apps
2+
3+
👨‍💼 Some apps are so simple they don't even have a `package.json` file. Instead
4+
they just have an index file which is automatically opened in the playground.
5+
6+
If an `index.html` is present, that's what gets rendered. Otherwise, one is
7+
created automatically and `index.js` (or `index.ts`) is loaded into it. Even
8+
`index.css` will be loaded.
9+
10+
These also can have tests as well, and they run automatically when you open the
11+
Test tab.
12+
13+
🐨 Go ahead and complete this exercise. Notice how the playground directory only
14+
has a single file in it.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const button = document.createElement('button')
2+
button.textContent = 'Click me'
3+
button.addEventListener('click', () => {
4+
// 🐨 change this to navigate to https://www.youtube.com/watch?v=dQw4w9WgXcQ
5+
// using the global `open` function
6+
alert('TODO')
7+
})
8+
9+
document.body.appendChild(button)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Simple Apps
2+
3+
👨‍💼 These kinds of apps will automatically refresh when you make changes.
4+
5+
Good job on this one!
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const button = document.createElement('button')
2+
button.textContent = 'Click me'
3+
button.addEventListener('click', () => {
4+
open('https://www.youtube.com/watch?v=dQw4w9WgXcQ')
5+
})
6+
7+
document.body.appendChild(button)

0 commit comments

Comments
 (0)