template.js
import { ReactiveMethod} from 'meteor/simple:reactive-method';
Template.staging.helpers({
'status': function () {
let status = ReactiveMethod.call('Staging.status');
return status;
}
});
template.html
<template name="staging">
<h1>Staging</h1>
<table class="table">
<tr><th>New Documents</th><td>{{status.new}}</td></tr>
<tr><th>Documents in Error</th><td>{{status.error}}</td></tr>
</table>
</template>
I have tried multiple different versions of this, which always lead to ReactiveMethod complaining it can’t be used outside of a Tracker Computation.
Ideally I’d want the values to update for example on a set interval of 5 seconds, but I can’t wrap ReactiveMethod.call to interval without “…outside Tracker Computation”-error.
How to achieve this without having to publish anything from the collection to the client - I just want counts via ReactiveMethod.call?
Now only way to get updated values is by refreshing browser, which is far from ideal…