Open nsaunders opened 7 years ago
POJO stands for Plain Old JavaScript Object.
I am aware of the acronym, thanks. I'm looking for a more precise definition.
I think it's commonly used to distinguish between objects that are created via object literals, and objects created via new
expressions or Object.create
— i.e. no prototype. Also, if an object has getters and setters I'd no longer consider it a POJO.
The reason for the prohibition is if you had something like this...
<script>
export default {
data () {
return new Foo();
}
};
</script>
...then you might get unexpected behaviour.
Is it proper for a data property, for example, to reference a function?
It's fine to do that, though referenced functions should be pure. Alternatively you can put those functions on helpers
.
Not sure how to communicate all that succinctly in the docs!
In the component.set API documentation, what exactly is meant by the term "POJO"? Is it proper for a data property, for example, to reference a function?
I just noticed b3a79f1710052c84597bfbe93db79142fc595bb3, and it's a great start, but still could be further explained IMO.