This is work in progress towards a reimplementation of the qooxdoo Class and Property systems.
This is a mostly fresh implementation of qx.Bootstrap and qx.Class which implements classes using a Proxy. This avoid the necessity for implementing classes' properties using generated code, and greatly simplifies the qx.Bootstrap.define() and its property handling code.
- The test program is
test.jsbut the hierarchy of dependencies that must be defined prior to the test code is implmented inboot.js. Therefore, to run the test program, do:node boot.js
- define
- undefine
- type
- abstract
- static
- singleton
- extend
- implement [Interfaces]
- include [Mixins]
- in-definition ("includes" key)
- addition of, via
include() - modification of, via``patch()`)
- construct
- statics
- properties
- members
- environment
- events
- defer
Notes: Call defer() late. See
addPendingDeferandexecutePendingDefersin original qx.Bootstrap - destruct
- this.constructor
- annotations
- refresh()
- check (currently just says what it would do)
- stock check strings mapped to check methods
- apply (as both string member name and as function)
- event (currently just says what it would do)
This implementation always generates an event. If there's no
eventkey in the property definition, the event name is created automatically aschange${propertyFirstUp} - themeable
- inheritable
- init
- nullable
- refine (currently allows complete redefinition of property)
- transform
- validate
- dereference
- deferredInit (deprecated; see
initFunction, below) - isEqual
- property groups
- name
- group
- mode
- themeable
- generated methods
- getProperty()
- setProperty()
- initProperty()
- isProperty() -- if
check === "Boolean" - toggleProperty() -- if
check === "Boolean" - getPropertyAsync() -- if
async - setPropertyAsync() -- if
asyncandapply - setThemedProperty() -- if 'themeable'
- resetThemedProperty() -- if 'themeable'
- resetProperty() -- if 'inheritable'
- refreshProperty -- if 'inheritable'
- native properties
- properties are first-class objects Additionally, there is now a qx.core.PropertyDescriptorRegistry class wich is automatically instantiated by qx.Class.define when a class is defined. It stores the definition of each property as well as each of the properties' functions. Retrieving a property's property descriptor binds the functions to the object on which the retrieval was made, so that they can be used from the retrieved property descriptor to get information about, or alter, that object's property.
- readonly properties, implemented via
immutable : "readonly" - storage can be completely replaced. Storage mechanisms must
implement
qx.core.propertystorage.IStorage. There are three four available storage mechanisms:qx.core.propertystorage.Defaultis (duh!) the default one. It stores values in the object containing the property.qx.core.propertystorage.ImmutableArrayis used for Array members. It intercepts set operations, replacing all elements in the existing array with the elements in the given array.qx.core.propertystorage.ImmutableObjectis used for native Object members. It intercepts set operations, replacing all members of the existing object with the elements in the given object.qx.core.propertystorage.ImmutableDataArrayis used forqx.data.Arraymembers. It intercepts set operations, replacing all members of the existingqx.data.Arrayobject with the elements in the givenqx.data.ArrayorArray.
- [?] eliminate need for pseudo-properties (maybe done?)
- [?] eliminate need for property sniffing/detection (maybe done?)
- support for private and protected properties
- more advanced and reusable type checking Implemented parsing of JSDoc type strings (but then failing the check if it parsed because nothing yet validates the value against the AST
- immutability.
Immutability takes two forms:
- readonly properties. Any property can be readonly, as specified with `immutable : "readonly".
- altering the contents of an existing reference object rather than
replacing that object, when
setis called. This is implemented via the new replaceable storage facility. The developer may either specifystorage : myPkg.storage.MyStorage(which must implementqx.core.propertystorage.IStorage); or for the three qooxdoo-provided types of immutable storage, may specifycheck : <type>(where type is one of "Array", "Object", or "qx.data.Array" and also specifyimmutable : "replace". In the latter case, the appropriate storage class is selected automatically.
- mutation detection
- fast property definition
- integration with references
-
initFunction(in lieu ofinit). Added to a property definition, this is a function that will be called with one argument: the property name. It is called wheninitProperty()is called, but callinginitProperty() is generally unnecessary, as theinitFunction` is called automatically, immediately before the constructor is called. The function should return the initial value. This allows a unique initial value, even if it's a reference type, per object instance. - hard
- weak
- soft
- on-demand
- transparant, async object destructors and garbage collection
-
- indexed values accessed as if it were a native array
- base -- don't include automatically after bootstrap; use one in Object.js
- emulate
__emitCallCallbackfrom Property.js:1974- "refresh"
- fire event.