Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite6e04d2

Browse files
committed
refactor(toast): migrate visible to linkedSignal
1 parent804218e commite6e04d2

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

‎projects/coreui-angular/src/lib/toast/toast/toast.component.ts‎

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
ElementRef,
88
inject,
99
input,
10+
linkedSignal,
1011
numberAttribute,
1112
OnDestroy,
1213
OnInit,
@@ -98,26 +99,23 @@ export class ToastComponent implements OnInit, OnDestroy {
9899
*/
99100
readonlyvisibleInput=input(false,{transform:booleanAttribute,alias:'visible'});
100101

101-
readonly #visibleInputEffect=effect(()=>{
102-
this.visible=this.visibleInput();
102+
readonly #visible=linkedSignal(this.visibleInput);
103+
104+
readonly #visibleEffect=effect(()=>{
105+
constnewValue=this.#visible();
106+
newValue ?this.setTimer() :this.clearTimer();
107+
this.visibleChange?.emit(newValue);
108+
this.changeDetectorRef.markForCheck();
103109
});
104110

105111
setvisible(value:boolean){
106-
constnewValue=value;
107-
if(this.#visible!==newValue){
108-
this.#visible=newValue;
109-
newValue ?this.setTimer() :this.clearTimer();
110-
this.visibleChange?.emit(newValue);
111-
this.changeDetectorRef.markForCheck();
112-
}
112+
this.#visible.set(value);
113113
}
114114

115-
getvisible(){
116-
returnthis.#visible;
115+
getvisible():boolean{
116+
returnthis.#visible();
117117
}
118118

119-
#visible=false;
120-
121119
/**
122120
*@ignore
123121
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp