eberon
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2012
08:02 PM
Slight delay pattern for roSearchScreen?
Hello,
Total newbie here, guys!
Can anyone think of a pattern that would let me delay execution for a little while after a user has entered a character on roSearchScreen?
If I were at my day job programming a web application I would set an asynchronous timeout as soon as a key was pressed, then cancel the timeout if another key was pressed and re-set it again. If the timeout were reached, I would go ahead and execute a search.
I'm trying to be sensitive to the fact that I don't own the service I'm programming against, so I can never truly know how performant it will be or how tolerant they would be of several requests in rapid succession from the same client, from my program.
If no one is worried about this and everyone is implementing calling out to the Internet as soon as a "key" is pressed on roSearchScreens, that's fine and good to know, but I thought I'd ask...
Thanks!
Total newbie here, guys!
Can anyone think of a pattern that would let me delay execution for a little while after a user has entered a character on roSearchScreen?
If I were at my day job programming a web application I would set an asynchronous timeout as soon as a key was pressed, then cancel the timeout if another key was pressed and re-set it again. If the timeout were reached, I would go ahead and execute a search.
I'm trying to be sensitive to the fact that I don't own the service I'm programming against, so I can never truly know how performant it will be or how tolerant they would be of several requests in rapid succession from the same client, from my program.
If no one is worried about this and everyone is implementing calling out to the Internet as soon as a "key" is pressed on roSearchScreens, that's fine and good to know, but I thought I'd ask...
Thanks!
1 REPLY 1

TheEndless
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2012
08:19 PM
Re: Slight delay pattern for roSearchScreen?
I typically use a very low wait time (250ms), record the isPartialResult() in a variable, then act on that partial result on the next "invalid" event. That essentially introduces a 250ms delay between the last letter selection and calling out to the API, and allows for letters entered in rapid succession to stack instead of queuing up for multiple API queries (i.e., one api.Search() call for "test" instead of four for "t", "te", "tes", and "test"). You could adjust that wait time up or down depending on your preference for delay.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)