[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

example[spec] Modify a listener handler of a widget

" select a task, start it "
" modify #selected: event handler of Task Information widget "
" self is a MobilePageJSon instance "
| jsObject js coordinatorConf widgetsSpec widgetConf config widgetListenersSpec newHandler |
newHandler := [:item :coordinator | Transcript show: #OK ].
jsObject := self template basicAt: #spec.
js := JS @ jsObject. 
coordinatorConf := js @ #configuration.
widgetsSpec := JS @ coordinatorConf @ #widgets.
widgetConf := JS @ widgetsSpec @ #information.
config := JS @ widgetConf @ #configuration.
widgetListenersSpec := JS @ config @ #listeners.

" modify #selected: event handler "
JS @ widgetListenersSpec handleAt: #selected: put: newHandler.

" refresh rendered UI "
self thread update