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

example[spec] Add a widget -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 "
" add a new text widget at the bottom of the rendered UI "
| jsObject js widgets newSpec currentThread coordinator |
currentThread := (App threads select: [:thread | thread tool = #mobile]) first.

coordinator := currentThread coordinator.

jsObject := coordinator template basicAt: #spec. 
js := JS @ jsObject. 
widgets := (JS @ (js @ #configuration)) @ #widgets.

" define the spec for the new widget "
newSpec := (#class -> #MobileText ),
		(#configuration -> ( (#order -> 2),(#text -> 'test text!') )).

" install new widget "
(JS @ widgets) handleAt: #newText put: newSpec json. 

" udpate rendered UI "
App fromJSon: (App basicAt: #spec).
App open