Picture of Rob Mausser
Child .js in theme?
by Rob Mausser - Tuesday, 30 October 2018, 6:34 PM
 

Ive learned how to copy and paste Less and Handlebars files from components/extensions to the Themes folder, to mod and override an extension/component without modifying the original plugin.

However, a mod I want to do to an extension requires changing a .js file. 

I cannot change the plugin, as its shared in our Authoring Tool with other courses. 

Id rather not create a copy of the plugin, as that eventually will create a lot of fragmentation, issues with updates, etc etc. 

Is there a way to override or mod a plugins .js in the theme, much like can be done with Less/Handlebars?

 

Thanks

Picture of Matt Leathes
Re: Child .js in theme?
by Matt Leathes - Tuesday, 30 October 2018, 11:35 PM
 

It it helps, you can override functions within the plugin using a technique that's known as duck punch programming

There's an example of this in the assessment extension here where it extends the functionality of the initialize method of both ArticleModel and ArticleView with new functionality.