[24:7] extends: FxObj
Wraps an AussomSerializableType (implementation of FXGL's SerializableType interface) so Aussom code can supply persistence behaviour to APIs that take a SerializableType. The two on* methods register callbacks for write and read; each receives a Bundle wrapper. Example: st = new SerializableType(); st.onWrite(::saveMyState); st.onRead(::loadMyState); public saveMyState(bundle) { bundle.put("hp", 42); } public loadMyState(bundle) { hp = bundle.get("hp"); }
SerializableType ()
Creates a new SerializableType bridge ready to receive onWrite / onRead callbacks.
adopt (object Ajo)
Wraps an existing AussomSerializableType AussomJavaObject.
Ajo is an AussomJavaObject around an AussomSerializableType.A new wrapper.onWrite (callback Cb)
Registers the write callback. The callback receives a Bundle wrapper and stores state in it.
Cb is a callback (bundle) -> any.this objectonRead (callback Cb)
Registers the read callback. The callback receives a Bundle wrapper and restores state from it.
Cb is a callback (bundle) -> any.this objectwrite (object BundleObj)
Triggers the write callback with the supplied Bundle.
read (object BundleObj)
Triggers the read callback with the supplied Bundle.