-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
OCP namespaces for JS code #17610
Comments
Hmm, remember that we also have the "OCA" namespace for apps. So file list related stuff might need to stay in "OCA". We don't have public namespaces for OCA either on the PHP side. |
Indeed! Might be a good idea to try and sort that one out as well. oC can't tell devs to not have inter-app communication and then only offer some APIs via OCA.Files, even if I understand that Files is a special app. There is also the problem that different methods have to be called depending on whether the Files app is reached via a private or a public URL. On the PHP side, we don't need to call any Files methods afaik, everything is available via the public framework or OCP. |
OCP namespace sounds reasonable for any logic/code which is provided by core (outside the scope of any app). Big question to me: which functionality would this be? Almost anything listed above is related to giving apps the possibility to be extended by other apps. Based on the idea to have apps isolated and not depend on each other this is a rather tricky topic. |
We could have some kind of service provider in core and apps can register their service providers there. I believe we might have a similar discussion already for the PHP side. As for FileActions alone, we could move this to core. I think any app might be interested to get access to file viewers (ex: opening an attachment from the mail app) without having to resort to the files app (which is a file list app). But this requires all file viewers to follow a specific API and not assume that there is a file list present and just embed themselves. See #13414 |
makes a lot of sense IMHO. Should help to avoid a lot of strange inter app dependency bugs. |
like the idea but i agree #17169 should be resolved before hand. imho |
OCP.EventSource (JS) is missing for apps builders #12800 |
@oparoz added |
So far the JS code doesn't have any difference between public and private namespace.
We should introduce a "OCP" namespace and rewire/wrap functions/classes to their corresponding private counterparts.
Please note that Javascript doesn't have the concept of interfaces.
In some cases it might be enough to just alias a class or object, for example:
In more complex cases, a wrapper class can be used. Functions can be aliased one by one, or wrapped in other functions.
The first steps would be to identify what APIs are already used by apps, like the OC namespace.
This will significantly increase the number of Javascript files, so we might want to solve the module loading / JS dependencies problem first: #17169
If we don't it means an app developer might have to add a lot of extra files with
addScript
in the correct order (private first, then public) to make sure the wrapping is done properly.This ticket is to discuss and brainstom how to do this in the future.
@MorrisJobke @Raydiation @rullzer @oparoz @icewind1991 @schiesbn @karlitschek @DeepDiver1975
The text was updated successfully, but these errors were encountered: