-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
5,052 additions
and
2,013 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 7 additions & 7 deletions
14
content/4-component-composition/5-context/ember/user-profile.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
<div> | ||
<h2>My Profile</h2> | ||
<p>Username: {{this.user.username}}</p> | ||
<p>Email: {{this.user.email}}</p> | ||
<button {{on "click" (fn this.userService.updateUserName "Jane")}}> | ||
Update username to Jane | ||
</button> | ||
<div> | ||
<h2>My Profile</h2> | ||
<p>Username: {{this.user.username}}</p> | ||
<p>Email: {{this.user.email}}</p> | ||
<button {{on "click" (fn this.userService.updateUserName "Jane")}}> | ||
Update username to Jane | ||
</button> | ||
</div> |
20 changes: 10 additions & 10 deletions
20
content/4-component-composition/5-context/ember/user-profile.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import Component from '@glimmer/component'; | ||
import { service } from '@ember/service'; | ||
|
||
export default class UserProfileComponent extends Component { | ||
@service userService; | ||
|
||
get user() { | ||
return this.userService.user; | ||
} | ||
} | ||
import Component from "@glimmer/component"; | ||
import { service } from "@ember/service"; | ||
|
||
export default class UserProfileComponent extends Component { | ||
@service userService; | ||
|
||
get user() { | ||
return this.userService.user; | ||
} | ||
} |
44 changes: 22 additions & 22 deletions
44
content/4-component-composition/5-context/ember/user-service.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
import Service from '@ember/service'; | ||
import { tracked } from '@glimmer/tracking'; | ||
import { action } from '@ember/object'; | ||
|
||
export default class UserServiceService extends Service { | ||
@tracked id = 1; | ||
@tracked username = 'unicorn42'; | ||
@tracked email = '[email protected]'; | ||
|
||
get user() { | ||
return { | ||
id: this.id, | ||
username: this.username, | ||
email: this.email, | ||
}; | ||
} | ||
|
||
@action | ||
updateUserName(newUsername) { | ||
this.username = newUsername; | ||
} | ||
} | ||
import Service from "@ember/service"; | ||
import { tracked } from "@glimmer/tracking"; | ||
import { action } from "@ember/object"; | ||
|
||
export default class UserServiceService extends Service { | ||
@tracked id = 1; | ||
@tracked username = "unicorn42"; | ||
@tracked email = "[email protected]"; | ||
|
||
get user() { | ||
return { | ||
id: this.id, | ||
username: this.username, | ||
email: this.email, | ||
}; | ||
} | ||
|
||
@action | ||
updateUserName(newUsername) { | ||
this.username = newUsername; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<!DOCTYPE html> | ||
<!doctype html> | ||
<html> | ||
<body> | ||
<app-root></app-root> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<!DOCTYPE html> | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<script type="module" src="./main.ts"></script> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<!DOCTYPE html> | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<script type="module" src="./app.js"></script> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<!DOCTYPE html> | ||
<!doctype html> | ||
<html> | ||
<body> | ||
<div id="app"></div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<!DOCTYPE html> | ||
<!doctype html> | ||
<html> | ||
<body> | ||
<div id="app"></div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<!DOCTYPE html> | ||
<!doctype html> | ||
<html> | ||
<body> | ||
<div id="app"></div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<!DOCTYPE html> | ||
<!doctype html> | ||
<html> | ||
<body> | ||
<div id="app"></div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,6 @@ | |
|
||
<script> | ||
export default { | ||
name: 'App' | ||
} | ||
</script> | ||
name: "App", | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<!DOCTYPE html> | ||
<!doctype html> | ||
<html> | ||
<body> | ||
<div id="app"></div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import Vue from 'vue' | ||
import App from './App.vue' | ||
import Vue from "vue"; | ||
import App from "./App.vue"; | ||
|
||
new Vue({ | ||
el: '#app', | ||
el: "#app", | ||
components: { App }, | ||
template: '<App/>' | ||
}) | ||
template: "<App/>", | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<!DOCTYPE html> | ||
<!doctype html> | ||
<html> | ||
<body> | ||
<div id="app"></div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { createApp } from 'vue' | ||
import App from './App.vue' | ||
import { createApp } from "vue"; | ||
import App from "./App.vue"; | ||
|
||
createApp(App).mount('#app') | ||
createApp(App).mount("#app"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.