Skip to content

Commit 63acef5

Browse files
committed
added some web-experience code
1 parent 4037575 commit 63acef5

File tree

3 files changed

+77
-3
lines changed

3 files changed

+77
-3
lines changed

dist/breinify-web-experiences.js

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,50 @@
1111

1212
const $ = Breinify.UTL._jquery();
1313
const _private = {
14+
setup: function(configuration, module) {
15+
console.log('using configuration', configuration);
1416

17+
// ensure that we utilize the onChange method over the ready method
18+
if ($.isFunction(module.ready) && !$.isFunction(module.onChange)) {
19+
module.onChange = module.ready;
20+
module.ready = null;
21+
}
22+
23+
// next check if we have limitations on the path and set up the isValidPage
24+
let currentIsValidPage = null;
25+
if ($.isFunction(module.isValidPage)) {
26+
currentIsValidPage = module.isValidPage;
27+
}
28+
29+
module.isValidPage = null;
30+
module.findRequirements = null;
31+
}
1532
};
1633

1734
const WebExperiences = {
35+
setup: function (id, configuration, module) {
1836

19-
};
37+
// the module must be a valid object
38+
if (typeof module !== 'object') {
39+
console.error('the module with id "' + id + '" is not a valid module and cannot be setup');
40+
return;
41+
}
2042

43+
// check if we have the trigger plugin
44+
if (Breinify.plugins._isAdded('trigger') === true) {
45+
46+
// if we have the trigger plugin ensure that we initialize it before we set up the module
47+
Breinify.plugins.trigger.init();
48+
_private.setup(configuration, module);
49+
} else {
50+
console.error('the trigger plugin is not available, ' +
51+
'skipping setup of the web-experiences with id "' + id + '"');
52+
return;
53+
}
54+
55+
Breinify.plugins.api.addModule(id, module);
56+
}
57+
};
2158

2259
// bind the module
2360
Breinify.plugins._add('webExperiences', WebExperiences);

dist/breinify-web-experiences.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/plugins/WebExperiences.js

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,50 @@
1111

1212
const $ = Breinify.UTL._jquery();
1313
const _private = {
14+
setup: function(configuration, module) {
15+
console.log('using configuration', configuration);
1416

17+
// ensure that we utilize the onChange method over the ready method
18+
if ($.isFunction(module.ready) && !$.isFunction(module.onChange)) {
19+
module.onChange = module.ready;
20+
module.ready = null;
21+
}
22+
23+
// next check if we have limitations on the path and set up the isValidPage
24+
let currentIsValidPage = null;
25+
if ($.isFunction(module.isValidPage)) {
26+
currentIsValidPage = module.isValidPage;
27+
}
28+
29+
module.isValidPage = null;
30+
module.findRequirements = null;
31+
}
1532
};
1633

1734
const WebExperiences = {
35+
setup: function (id, configuration, module) {
1836

19-
};
37+
// the module must be a valid object
38+
if (typeof module !== 'object') {
39+
console.error('the module with id "' + id + '" is not a valid module and cannot be setup');
40+
return;
41+
}
2042

43+
// check if we have the trigger plugin
44+
if (Breinify.plugins._isAdded('trigger') === true) {
45+
46+
// if we have the trigger plugin ensure that we initialize it before we set up the module
47+
Breinify.plugins.trigger.init();
48+
_private.setup(configuration, module);
49+
} else {
50+
console.error('the trigger plugin is not available, ' +
51+
'skipping setup of the web-experiences with id "' + id + '"');
52+
return;
53+
}
54+
55+
Breinify.plugins.api.addModule(id, module);
56+
}
57+
};
2158

2259
// bind the module
2360
Breinify.plugins._add('webExperiences', WebExperiences);

0 commit comments

Comments
 (0)