soney / constraintjs

Constraint library for JavaScript

Home Page:cjs.from.so/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Read-only constraints

QuentinRoy opened this issue · comments

Protecting an internal constraint is I guess quite easy: one only have to provide a 'public' constraint on its 'private' constraint instead of the 'private' constraint itself. But the setter of this public constraint is still callable and one may still re-set it.

At the opposite, a view on the 'private' constraint would be only get-able. The idea is that it reacts and can be used exactly as any other constraint. It would of course still be invalidated by its parent constraint... But one cannot change directly its value.

Thus, one could expose a bunch of protected constraints as an interface.