You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
functionuseTrack(){constowner=getOwner();const[changed,setChanged]=createSignal(false);changed();returnfunctionref<T>(signal: Accessor<T>): T {returnrunWithOwner(owner,()=>{if(changed()===true){returnsignal();}
let value: T;consttrack=createReaction(()=>setChanged(true));track(()=>(value=signal()));returnvalue!;})!;};
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I wrote a function to track signals manually:
Example usage:
I wonder if there is any issue with that function. I've done some tests, and it seems to work fine.
Beta Was this translation helpful? Give feedback.
All reactions