compoxure icon indicating copy to clipboard operation
compoxure copied to clipboard

JS function parameter for backend configuration

Open hedav85 opened this issue 9 years ago • 3 comments

For different backends I have definded JS-functions. This functions are called with two parameters:

req.backend = _.find(config.backend, function(server) {
          if (server.pattern) { return new RegExp(server.pattern).test(req.url); }
          if (server.fn) {
            if (typeof config.functions[server.fn] == 'function') {
              return config.functions[server.fn](req, req.templateVars);
            }
          }
      });

For my situation it would be good to have the current config also as a parameter.

return config.functions[server.fn](req, req.templateVars, server);

Then it is possible for me to add own configurations and to check against them in my JS-function.

What do you think about it?

hedav85 avatar Jan 07 '16 16:01 hedav85

Definitely - its a good idea, and an oversight really. Are you able to submit a PR?

cliftonc avatar Jan 07 '16 17:01 cliftonc

Yes I'll submit a PR in the next days.

hedav85 avatar Jan 08 '16 08:01 hedav85

@sithmel we should do this.

cliftonc avatar Jan 12 '18 14:01 cliftonc