Ive read the documentation and seen people ask for help with them on this forum and they got redirected to use something else.
From the places I found it mentioned in Cesium’s github issues it sounds like it was created to help out us typescript users but I can’t find enough general stuff on the web about propertybags to really get a grasp for it. Can you pass a propertyBag to an entity instead of newing a bunch of ConstantProperty’s?
So… why, when, and how Cesium’s propertybags? example?
Omar is of course correct that you can think of it as a key/value map, but the important difference from a plain object is that a PropertyBag is a Property, i.e. it has a getValue(time) method, which allows the value to vary based on simulation time.
It also adds a property (lower-case P) to the PropertyBag that contains the “raw” (not Property-wrapped) value that corresponds to each key:
IMHO, this is also kind of confusing, because if you pass a Property to the constructor, the bag’s getValue method evaluates the Property, but the “index operator” (pb.position or pb["position"]) returns the unevaluated Property and you have to call its getValue method:
const pb = new PropertyBag({position: new ConstantPositionProperty(Cartesian3.fromDegrees(10,20))});
const now = JulianDate.now();
const {position} = pb.getValue(now);
position.equals(pb.position.getValue(now)); // true