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

example[spec] Modify the listener of a MobileCoordinator -changed for ios

First load mobile[iosTesting]Two tabs app for testing in ios
" two-tabs app is used for this example "
" In global App: MobileApplication instance "
| currentThread jsObject coordinator templates dates templateConf templateListeners newHandler |

newHandler := [:coordinator | #NewDates ].
jsObject := App basicAt: #spec. 
templates := (JS @ jsObject) @ #templates. 
dates := (JS @ templates) @ #dates.
templateConf := (JS @ dates ) @ #configuration. 
templateListeners := (JS @ templateConf ) @ #listeners. 

" modify the handler for #needsTitle "
(JS @ templateListeners) handleAt: #needsTitle put: newHandler.

" move to next coordinator to check the title has changed "
currentThread := (App threads select: [:thread | thread tool = #mobile]) first.
coordinator := currentThread coordinator.
coordinator thread next: ((coordinator newTemplateAt: #dates) model: coordinator model;yourself).