-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documentation on InterruptSource #51
Comments
Please respond to this request. It is the minimum you could do to help us implement custom interrupt sources |
Have you looked at the source code for any of the interrupts? It's intentionally pretty vague, because I don't want to create too much of an opinion about what your custom source needs to do. However, In its simplest form, an interrupt source simply needs to emit from the Your actual implementation, however, may be more sophisticated than that. Here's what happens:
So using In the constructor, you provide a target (which is anything that can be made Observable) a space-delimited list of event names on the target that should trigger an interrupt, and optionally time in milliseconds that will throttle incoming events (so we don't swarm your app with user input). We split the events list and enumerate for each event, creating an observable event source, and adding it to a list of event sources that we need to keep track of so we can properly dispose them later. It then creates a handler for the So now that we've constructed an instance, when a user causes one of the specified events on target, it'll cause an interrupt while the source is attached. When the source is detached, it removes all event handlers and stops listening for user activity. Attaching and detaching is important in the context of browser events to prevent memory leaks and avoid performance problems. However, that implementation detail is up to your custom handler. I do provide it in the base class so you can receive notification when idle is or isn't requesting interrupts, but if you don't need to attach or detach, you can simply ignore attach/detach and focus on working with |
Thank you very much for such detailed response. This will certainly put me on the right path. |
i actually wanted the idle.setInterrupts for only mouse click events not for hover or any other event...don't know how to go about it |
@alex-ponce Can you or someone provide a sample code for setting a list of interrupts. For example, I specifically want the system to remain idle during mouse hovers. |
@rahul2270 did you find any example for setting a list of interrupts. I specifically just want to interrupt only on mouse click |
@Peroucho8 @pjyoti1235 @rahul2270
Hope this helps |
Is it possible to get more documentation on how to implement our own custom interrupt source? I haven't seen this anywhere in the documentation.
In my case, I want the user to no longer be considered idle whenever he moves his mouse or presses a key on the keyboard, not just within the tab, but anywhere on the computer, or at least in the browser.
I'm seeing
InterruptSource
as an abstract class, but am not sure which properties it wants me to define when I extend from it It also looks likeattachFn
anddetachFn
are parameters passed to the constructor when instantiated, but I don't understand what should happen in these functions or what the purpose of them is. I assumeattachFn
attaches the event it wants to listen to tothis
somehow but isdetachFn
called during destruction?The text was updated successfully, but these errors were encountered: