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

How to properly use the pre/post process callbacks? #71

Open
hanoii opened this issue Jun 23, 2017 · 2 comments
Open

How to properly use the pre/post process callbacks? #71

hanoii opened this issue Jun 23, 2017 · 2 comments
Labels

Comments

@hanoii
Copy link
Contributor

hanoii commented Jun 23, 2017

Do I need to add something manually to jDrupal.modules for it to be picked up and then just define a function in the global scope?

so would it be:

  1. jDrupal.modules['something']
    and then

2.function something_rest_pre_process(xhr, data) {} on the global spec?

Is 1 necessary?

@signalpoint
Copy link
Owner

signalpoint commented Jun 27, 2017

@hanoii Yes, step no. 1 is necessary. Perhaps we should add something like jDrupal.addModule(); (and some corresponding docs) to make this more intuitive. Not many people get into jDrupal custom modules, 99% of the time people are using jDrupal by way of DrupalGap, and the usage of modules that way is much more well documented. Then we could have something like:

jDrupal.addModule('something');
function something_rest_pre_process(xhr, data) {
  // Do something...
}

Your thoughts?

@hanoii
Copy link
Contributor Author

hanoii commented Jun 27, 2017

that's fine although it was mainly lack of documentation.

As for further thoughts/preference I would have preferred something that doesn't require me to add it to the global spec.

Maybe using javascript events.

Or, if you want to still add it to jDrupal, maybe do it in a way similar to Drupal.behaviors where what you add there has the methods self-contained.

But this could possible mean quite a in the logic for you I guess and as you say is for little uses.

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

No branches or pull requests

2 participants