Skip to content

Commit 3446261

Browse files
committed
Add plugin loader for frontend soft plugin enabling
1 parent 4150f92 commit 3446261

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

frontend/express/views/dashboard.html

+16
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,22 @@
2929
ignoreURLs: ["action=refresh", "method=live", "stats.count.ly", "method=get_events", "display_loader=false"]
3030
}
3131
};
32+
window.loadPlugin = function(plugin, callback, args){
33+
if (typeof plugin !== "string") {
34+
console.log("when loading plugin, provided plugin was not a string, but a", plugin);
35+
}
36+
if (typeof callback !== "function") {
37+
console.log("when loading plugin", plugin, "provided callback was not a function, but a", callback);
38+
}
39+
if (countlyGlobal.plugins.indexOf(plugin) !== -1) {
40+
if (Array.isArray(args)){
41+
callback.apply(window, args);
42+
}
43+
else {
44+
callback(args);
45+
}
46+
}
47+
};
3248
</script>
3349
<link rel="stylesheet" href="<%- cdn %>stylesheets/font-awesome/css/font-awesome.min.css?<%= countlyVersion %>" />
3450
<link rel="stylesheet" href="<%- cdn %>stylesheets/countly-icons/style.css?<%= countlyVersion %>" />

0 commit comments

Comments
 (0)