Library Reference
...
JS Library
Events
Events callback
2min
Below are some useful callback examples.
See : Events for more detals on syntax and options
JS
1
2klevu.coreEvent.attach("setRemoteConfigQuickOverride", {
3 name: "attachRemoteConfigQuickOverride",
4 fire: function () {
5 klevu.each(
6 klevu.search.extraSearchBox, function (key, box) {
7
8 box.getScope().chains.events.focus.add({
9 name: "customFocusEvent",
10 fire: function (data, scope) {
11 console.log("[EVENT] Quick Search on focus event");
12 }
13 });
14
15 box.getScope().chains.events.keyUp.add({
16 name: "customKeyUpEvent",
17 fire: function (data, scope) {
18 console.log("[EVENT] Quick Search on keyup event");
19 }
20 });
21
22 box.getScope().chains.request.send.add({
23 name: "customSendEvent",
24 fire: function (data, scope) {
25 console.log("[EVENT] Quick Search send search request");
26 }
27 });
28
29 box.getScope().chains.template.render.add({
30 name: "customRenderEvent",
31 fire: function (data, scope) {
32 console.log("[EVENT] Quick Search results rendering")
33 }
34 });
35
36 box.getScope().chains.template.events.add({
37 name: "customAfterRenderEvent",
38 fire: function (data, scope) {
39 console.log("[EVENT] Quick Search results rendered")
40 }
41 });
42
43
44 }
45 );
46 }
47});
JS
1klevu.search.landing.getScope().chains.template.events.add({
2 name: "renderResponseCustom",
3 fire: function(data, scope) {
4
5 console.log("Klevu Template rendered");
6
7 }
8});
.