FlowFuse / FlowFuse/node-red-dashboard

How exactly does a widget use ui_base?

Open
#1,289 28 comments 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
355
Forks
82
Avg merge
4d 23h
Merged PRs (30d)
24

Description

I read the dashboard 2 docs and understood that widgets are node-red nodes, and that they "extend" the ui_base config node, but I could not understand how exactly this happens. Somehow the widget's node has some additional methods called register/deregister. Probably has other, but I did not read everything yet. So, when/how exactly does a widget receive those 2 methods?

I'm planning to recreate it as a base class of Node class called, in the nrg project.

````js
export default class WidgetNode extends Node {

// specific WidgetNode properties

constructor(config){
super(config);
//initialize specific WidgetNode properties, such as state store
}

// specific WidgetNode methods, like register/ deregister
}

````

````js
export default class MyWidget extends WidgetNode {

constructor(config){
super(config);
}
}
````

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.