Class Franson.UI.PopupMenu
todo: expose CSS styling
todo: handle hierarchial menus?
Constructor
Franson.UI.PopupMenu(menuContent, [mode='stateless'])
- Parameters:
-
menuContent
<string>
-
[mode='stateless']
<string>
one of: [ 'stateless', 'checkbox', 'radiobutton' ]
Properties
_ih
- private IntervalHandler
interval at which to scan registered components for changes
State poller, brute force, doesn't depend on signals or similar. assumes state extraction is cheap.
intended for stuff that are not explicit settings, typically UI state etc.
states are treated as black-box JSON blobs.
todo: stubbed, WS-methods not set yet
todo: hmm, generalize this a bit. Prototype has a TimedObserver that is similar for example
todo: could be "fancy" and support different poll frequencty for different components etc.
ok name?
Methods
void
attach(element)
only run once!
- Parameters:
-
element
<DOM>
- Returns:
void
boolean
isStatefulLike(obj)
validate if obj implements the Interface necessary
for saving state. typically UI controls.
(ok name?)
note: also requirement that the "blob" from _saveState contains an .id property.
- Parameters:
-
obj
<object>
- Returns:
boolean
void
registerComponent()
todo: could take am (optional) comparer also?
todo: or optionally enable explicit signal attaching? (i.e remove obj from poll-loop only save when signalled)
void
setInterval(interval)
- Parameters:
-
interval
<integer>
ms
- Returns:
void
void
start()
starts the "thread" that keeps the
components' state in sync with server
void
stop()
stops the "thread"
void
unregisterComponent()