Update 'Home'

master
Claire 2 years ago
parent
commit
de77043148
  1. 30
      Home.md

30
Home.md

@ -99,24 +99,28 @@ private void txtData_KeyDown(CodeEditor sender, WebKeyEventArgs args)
The timer fires `TimerTick()` every half second. The first thing this function does is check if `isRendered` is `true`, and ends the function. Since we don't want the renderer to do anything if less than half a second has passed since the last `KeyDown` event, the function next checks to make sure at least half a second has passed since the value of `lastKeyUp`. Finally, if the function renders output, `isRendered` is set to true, and will be reset to `false` the next keypress detected by the Monaco control.
```csharp
if (isRendered)
void TimerTick(object sender, object args)
{
return;
}
// otherwise, we done got input, so do the thing
else
{
if (DateTime.Now.Ticks >= lastKeyUp + interval )
// if isRendered is true, there have been no changes to input since the last tick
if (isRendered)
{
// render output
...
isRendered = true;
return;
}
// otherwise, we done got input, so do the thing
else
{
return;
if (DateTime.Now.Ticks >= lastKeyUp + interval )
{
// render output
...
isRendered = true;
}
else
{
return;
}
}
}
```

Loading…
Cancel
Save