Hi, I’m a first time user that is trying to use PCUI and so far it’s been great. However, I can’t seem to get Data Binding to work even when just copy and pasting the example provided in the documentation:
import { BindingObserverToElement, BindingElementToObserver, Observer } from '@playcanvas/pcui/pcui-binding.js';
import { Label, TextInput } from '@playcanvas/pcui/pcui.js';
// create a new observer for a simple object which contains a text string
const observer = new Observer({text: 'Hello World'});
// create a label which will listen to updates from the observer
const label = new Label({
binding: new BindingObserverToElement()
});
// link the observer to the label, telling it to use the text variable as its value
label.link(observer, 'text');
// create a text input which will send updates to the observer
const textInput = new TextInput({
binding: new BindingElementToObserver()
});
// link the observer to the label, telling it to set the text variable on change
textInput.link(observer, 'text');
This is the result:
I can’t seem to resolve this TypeError issue, and was wondering if anyone knew what was going on. I’m not super experienced in webdev and I appreciate any and all input. Thanks in advance!