-
Notifications
You must be signed in to change notification settings - Fork 3
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
[RFC] Global events naming convention #131
Comments
Ref https://docs.nextcloud.com/server/stable/developer_manual/app/events.html#naming-scheme for what we do for php events |
A more high level question: do we want to prefix the event names with app IDs, if applicable? Like if more apps start using events the chances of a conflict arise if the events are named too generic, like Of course that does not apply to global stuff that is possibly emitted by the Nextcloud server. |
I like the idea, and thought about it, but will be a nightmare when the id is something like |
But that calls for conflicts.
That sounds actually fine to me? It's very clear what app this belongs to. |
Okay, so what about enforcing dashes with a nice str_replace on the library itself so everyone uses the same? :D |
Could you elaborate on your strong feelings against underscores? 🙊 |
it reminds me of lodash xD |
If we want to scope things with an app ID then we should allow the |
Okay then, let's move on! We go for appID every time? Or only for non-core ones? What about the modifier syntax?
|
Prefix for app events, no prefix for core ones?
I don't dislike it, but it would be quite different to the naming scheme with have for php events. Like if you create a file in php we'd use a
Sounds interesting but I do not have a real preference on that yet. Guess it depends on how much we use this. |
To be fair I'm fine to go for any solution. But I feel we should really start to ensure this is done properly :) |
What made me thought of this was the vue event syntax which I kinda like :) |
Though it should describe an event, not the action, hence use the past tense like |
So, any idea where we should document this? Shall we enforce it? i'm fine doing an lowercase on it 😉 |
I'd say it should got into our dev docs because that is also where we'll add any global events emitted by the server. And I would keep it simple and not transform the names (app prefix) too much. |
We could have an automated docs maybe? |
I doubt this would work reliably. Also we want to be careful what we document as official and what should remain internal. |
If there is a comment describing the event, we list it? Otherwise e don't? |
How would you do this? Scan all repos for supposedly emitted events? I don't get it |
Nah, ignore this, it seems too complicated. I was thinking an external service like we do for translations for example |
https://stackoverflow.com/a/61641681/2239067 for the names https://github.com/airbnb/javascript#events for pushing raw values vs an object (for easier modification later on) |
Call feedback:
@ChristophWurst since you're our @nextcloud/packages expert, how hard would it be to have a package for this? And how would it looks like? Wanna to a RFC? What did we say about the pass tense though? 🙈 |
This comment has been minimized.
This comment has been minimized.
this is okay, but e.g. there is a global event |
Intro
Welcome!
Since I find it quite awesome that we can use global events, I think we should aim for a nice convention.
Let's list an example of potential events we could see across Nextcloud... 🤔
Thoughts
Goals
I think it would be nice to have some kind of modifier syntax.
I really dislike underscores, so I would favour dashes.
Proposal
files:file.update
contacts:contact.delete
nextcloud:app.disable
nextcloud:unified-search.search
Sub-proposal
I would love to be able to watch for partial event names.
Like
file:update:12345
andfile:update
would both trigger if the file 13245 is updated?Questions
Shall we enforce the dashes and throw errorsShall we strongly suggest the syntaxevent:modifier:data
(e.g.file:update:12345
)If so, theheader-menu-unified-search:open
should most likely beheader-menu:open:unified-search
?Thanks!
cc @georgehrke @korelstar @ma12-co @juliushaertl @ChristophWurst @raimund-schluessler @danxuliu @rullzer
The text was updated successfully, but these errors were encountered: