Skip to content

Add the ability to use a closure as a "debounce" and "throttle" value in the onEvent decorator #4

@andyduke

Description

@andyduke

Replace debounce and throttle handling in EventsController.createHandler:

if (event.debounce) {
-  handler = debounce(handler, event.debounce);
+  handler = debounce(handler, (typeof event.debounce) == 'function' ? event.debounce.call(this.host, this.host) : event.debounce);
}
} else if (event.throttle) {
-  handler = throttle(handler, event.throttle);
+  handler = throttle(handler, (typeof event.throttle) == 'function' ? event.throttle.call(this.host, this.host) : event.throttle);
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions