unifiedremote / Docs

Official API documentation.
149 stars 33 forks source link

How to create button on demand (dynamically create layout) ? #24

Open linonetwo opened 4 years ago

linonetwo commented 4 years ago

I'd like to create a multi-touch bar using button components contains an icon and label like:

<grid ontap="foo_tapped">
    <label id="my_label" text="foo" />
    <button image="img.png" />
</grid>

And I'd like to create such component on new data comes from VSCode extension, which describes the button components to be render:

local s = require("socket").new();
s:ondata(function (data)
    local b = require("buffer").new("utf8");
    b:write(data);
    local button_data = b:readstring() // or something to get the new button list
end);

     libs.server.update(xxxx) // how to do so like I can do using document.createElement or ReactDom.render ?

I think I can use libs.server.update but https://github.com/unifiedremote/Docs/blob/master/libs/server#server_update is 404

And in https://github.com/unifiedremote/Docs/blob/master/libs/layout.md#advanced it is said that it can only handle lists or dialogs, can't handle complex component like the one above.

So how can I achieve this?