require.js will only execute the body of your js once. You should define a function which is configured once but executed multiple times.
popover.js
define(["jquery"], function($) {
var privateFunc = function(args) {
options = {
placement:'right',
trigger: 'hover',
container: 'body',
html: true
};
$('.pop').popover(options);
$('.pop').popover('show');
};
return { publicFunc: privateFunc};
});
java code
ajaxResponseRenderer.addCallback(new JavaScriptCallback() {
public void run(JavaScriptSupport javaScriptSupport) {
JSONObject args = new JSONObject("foo", "bar");
javaScriptSupport.require("popover").invoke("publicFunc").with(args);
}
});
See here for more info