daattali/shinyjs

`extendShinyjs(script = htmlDependency(...), functions = ...)` support

mmuurr opened this issue · 6 comments

I'm wondering if there's a simple way to specify the script file holding {shinyjs} 'extension' functions as an {htmltools} htmlDependency object, using then the absolute file resolution codepath of that dependency.

I realize addResourcePath() does something similar already, but as I write some standardized wrappers I was just curious if htmlDependency() had ever been considered :-)

Cheers and thanks!

I haven't thought of this before, so it's not supported. The only reason it's not supported is because this function was written many years ago before I understood how htmlDependency() works. This would be a good idea if anyone wants to try to implement it.

@mmuurr This should now be supported, you can use the script argument with an htmlDependency. Can you please let me know if it works for you?

Note to self: before closing the issue, update documentation anywhere that addResourcePath is used or where extendShinyjs is used

@daattali,

This should not be supported ...

I assume that's a typo and it actually should be, "This should now be supported"; correct?

(It's a shame that two dramatically different meanings are separable by only one character :-))

I should not be writing messages (or even worse, coding) at 4:50am... yet here we are. Hopefully the code was better than the message. Can you please verify that this works for you?

Yup, this seems to be working for me now; thanks!

(I still always struggle with the various options of htmlDependency() itself and how to get the output HTML tags to what I want, but that's {htmltools}' issue and the challenges that come with heavily-overloading a single function's optional parameters :-| )

Oh I also do! Every single time I need to use htmlDependency(), I do a github serach through my own repos to see how to use it. Every single time.