Skip to content

Commit d9a3210

Browse files
authored
Merge pull request #5614 from Countly/ar2rsawseen/master
Add plugin loader for frontend soft plugin enabling
2 parents 17f54c8 + ebf043e commit d9a3210

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

api/parts/data/cache.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@ class StreamedCollection {
971971
let [col, last] = await createCollection(this.db, this.name, 1e7);
972972

973973
this.col = col;
974-
this.stream = col.find({_id: {$gt: last}}, {tailable: true, awaitData: true, noCursorTimeout: true, numberOfRetries: -1}).stream();
974+
this.stream = col.find({_id: {$gt: last}}, {tailable: true, awaitData: true, numberOfRetries: -1}).stream();
975975

976976
this.stream.on('data', doc => {
977977
if (this.inserts.indexOf(doc._id.toString()) !== -1) {

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)