Actually I managed to get it to work on the phone by upgrading Chrome. According to caniuse, optional chaining became available in Chrome 80. In theory compatibility should extend all the way down to Kitkat. The lack of transpiling is a bit concerning though.
Widget doesn't render
-
I'm developing a simple widget here:
GitHub - FezVrasta/nodebb-widget-steamserverstatus: NodeBB widget to provide informations about a server which supports Steam API.
NodeBB widget to provide informations about a server which supports Steam API. - GitHub - FezVrasta/nodebb-widget-steamserverstatus: NodeBB widget to provide informations about a server which supports Steam API.
GitHub (github.com)
But the function to render the widget doesn't work..
Widget.renderStatusWidget = function(widget, callback) { var html = Widget.templates['status.tpl']; var serverIpPort = widget.data.server; var server = { host: serverIpPort.split(':')[0], port: serverIpPort.split(':')[1] }; ssq.info(server.host, server.port, function(err, data) { if (err) { console.log('Got error: ', err); return callback(err); } html = templates.parse(html, data); callback(null, html); }); };
I have even tried to replace this function with a simple
callback(null, "hello world")
but the widget never render.Any idea?
-
try to hook "filter:widget.render:nodebb-widget-steamserverstatus". I'm not sure, but there is some info in documentation:
NodeBB core will call your widget on the appropriate page load by way of the hooks system. The hook will be named after your widget’s namespace (see previous example) - like so: filter:widget.render:widget_namespace
-
@APXEOLOG said:
try to hook "filter:widget.render:nodebb-widget-steamserverstatus". I'm not sure, but there is some info in documentation:
NodeBB core will call your widget on the appropriate page load by way of the hooks system. The hook will be named after your widget’s namespace (see previous example) - like so: filter:widget.render:widget_namespace
Thanks but it doesn't work
-
Ok, according to https://github.com/NodeBB/NodeBB/blob/master/src/widgets/index.js#L37
widget_namespace
is what you define indefineWidget
function:widget: "steamserverinfo"
So try to bind filter:widget.render:steamserverinfo -
AHHH!!!! THANK YOUUU!!!!
What a stupid error
thanks!