asprin
Active member
Let's say I've this code:
One alternative I can think of is fetching the phrase inside a template and storing it on a HTML element via the
But wanted to check if all this can be avoided.
JavaScript:
var Asprin = window.Asprin || {};
/** @param {jQuery} $ */
!(function($, window, document, _undefined) {
'use strict';
Asprin.Foo = XF.Event.newHandler({
eventType: 'click',
eventNameSpace: 'Foobar',
init: function() {
},
click: function(event) {
// call \XF::phrase() here?
},
});
XF.Event.register('click', 'blahblah', 'Asprin.Foo');
})(jQuery, window, document);
One alternative I can think of is fetching the phrase inside a template and storing it on a HTML element via the
data-foobar
attribute and then pulling the content in javascript via element.getAttribute('data-foobar')
But wanted to check if all this can be avoided.