-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
using new LocalStorage service to keep track of Debug component visib…
…ility on load
- Loading branch information
1 parent
4bd121b
commit a8e3fb0
Showing
8 changed files
with
51 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,20 @@ | ||
import Component from '@glimmer/component'; | ||
import { service } from '@ember/service'; | ||
import { tracked } from '@glimmer/tracking'; | ||
import { action } from '@ember/object'; | ||
import ENV from 'remember-stuff/config/environment'; | ||
|
||
export default class DebugComponent extends Component { | ||
@tracked env = ENV.environment; | ||
@tracked app = ENV.APP; | ||
@tracked isExpanded = this.args.debugIsExpanded; | ||
@tracked isExpanded = this.args.isExpanded; | ||
|
||
@action | ||
bubbleSummaryUpToDetails(event) { | ||
console.log('clicked on details > summary'); | ||
|
||
event.target.parentElement.click(); | ||
} | ||
@service localStorage; | ||
|
||
@action | ||
saveDebugVisibility(event) { | ||
if (event.target.tagName == 'SUMMARY') { | ||
this.isExpanded = !this.isExpanded; | ||
saveDebugVisibility() { | ||
this.isExpanded = !this.isExpanded; | ||
|
||
localStorage.setItem(this.app.DEBUG_VISIBILITY_KEY, this.isExpanded); | ||
} | ||
this.localStorage.set('debugExpanded', this.isExpanded); | ||
} | ||
} |
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,16 +1,12 @@ | ||
import Controller from '@ember/controller'; | ||
import { tracked } from '@glimmer/tracking'; | ||
import ENV from 'remember-stuff/config/environment'; | ||
import { service } from '@ember/service'; | ||
|
||
export default class ApplicationController extends Controller { | ||
@tracked debugIsExpanded; | ||
@service localStorage; | ||
|
||
constructor() { | ||
super(...arguments); | ||
const lsDebugSetting = localStorage.getItem(ENV.APP.DEBUG_VISIBILITY_KEY); | ||
get debugVisibility() { | ||
const debugExpanded = this.localStorage.get('debugExpanded'); | ||
|
||
this.debugIsExpanded = lsDebugSetting || ''; | ||
|
||
console.log('LS debugIsExpanded set to:', this.debugIsExpanded); | ||
return debugExpanded; | ||
} | ||
} |
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
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