Skip to content
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

Document Event Listener Event Type Pattern #153

Open
ComLock opened this issue Jun 23, 2020 · 4 comments
Open

Document Event Listener Event Type Pattern #153

ComLock opened this issue Jun 23, 2020 · 4 comments
Assignees

Comments

@ComLock
Copy link
Contributor

ComLock commented Jun 23, 2020

ref: https://developer.enonic.com/docs/xp/stable/api/lib-event#listener

It's not RegExp, but similar

WRONG
'(node.(created|updated|deleted)|task..*)'

RIGHT
'(node.(created|updated|deleted)|task.*)'

So a dot, simply means a dot, not any char like in regexp.
And a asterix means wildcard. Uncertain wether it means anything, 0 or more times.

@rymsha
Copy link
Contributor

rymsha commented Jun 23, 2020

According to the code intention was to support some sort of glob syntax or even less.
. - means only dot
* - matches any number of any characters including none

so prefix.* matches anything that starts with prefix.
and first.second matches only first.second and nothing more

Everything else that "works" now but should not - I would consider a bug.

@ComLock
Copy link
Contributor Author

ComLock commented Jun 23, 2020

So the parentheses and pipe char to signify groups and alternatives should not work then?
Seems more like a nice magic feature to me :)

@rymsha
Copy link
Contributor

rymsha commented Jun 23, 2020

Indeed. Magic.
For your use-case create two listeners: node.* and task.*
In case you are not interested in node.push, filter it out in listener itself.

If you really want magic, subscribe to * and do a filtering in js code. It may be even more optimal for overall system throughput.

@ComLock
Copy link
Contributor Author

ComLock commented Jun 23, 2020

Well that's good to know. My assumption was that the API would be more optimised than each developers own code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants