12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- Smalltalk createPackage: '{%= name %}'!
- (Smalltalk packageAt: '{%= name %}' ifAbsent: [ self error: 'Package not created: {%= name %}' ]) imports: {'amber/jquery/Wrappers-JQuery'. 'amber/web/Web'. 'silk/Silk'}!
- Object subclass: #{%= name %}
- slots: {}
- package: '{%= name %}'!
- !{%= name %} methodsFor: 'action'!
- alert: aString after: aNumberOfMilliseconds
- [ Terminal alert: aString ] valueWithTimeout: aNumberOfMilliseconds
- !
- doAmberWith
- | tag |
- tag := (HTMLCanvas onJQuery: '#output-list' asJQuery) root.
- tag with: [ :html | html li with: 'Amber Web #with: added me!!' ]
- !
- doConsoleLog
- | greeting target |
- greeting := 'Hello'.
- target := 'world'.
- console log: #{ #greeting -> greeting. #target -> target. #callback -> [ console log: greeting, ', ', target, '!!' ] }
- !
- doJQueryAppend
- '#output-list' asJQuery append: '<li>jQuery append added me!!</li>'
- !
- doSilkTAG
- '#output-list' asSilk LI: 'Silk TAG: added me!!'
- ! !
- !{%= name %} methodsFor: 'starting'!
- augmentPage
- '#console-log' asSilk on: #click bind: [ self doConsoleLog ].
- '#timeout-alert' asSilk on: #click bind: [ self alert: 'REMINDER!!' after: 5000 ].
- '#amber-with' asJQuery click: [ self doAmberWith ].
- '#silk-tag' asSilk on: #click bind: [ self doSilkTAG ].
- '#jquery-append' asJQuery click: [ self doJQueryAppend ]
- ! !
- !{%= name %} class methodsFor: 'starting'!
- start
- self new augmentPage
- ! !
|