Smalltalk createPackage: 'Platform-Browser'! Object subclass: #BrowserInterface instanceVariableNames: '' package: 'Platform-Browser'! !BrowserInterface commentStamp! I am platform interface class that tries to use window and jQuery; that is, one for browser environment. ## API self isAvailable. "true if window and jQuery exist". self alert: 'Hey, there is a problem'. self confirm: 'Affirmative?'. self prompt: 'Your name:'. self ajax: #{ 'url' -> '/patch.js'. 'type' -> 'GET'. dataType->'script' }.! !BrowserInterface methodsFor: 'actions'! ajax: anObject self deprecatedAPI: 'Use newXhr or dedicated library.'. ^ JQuery ifNil: [ self error: 'JQuery wrapper not loaded, cannot do AJAX.' ] ifNotNil: [ JQuery current ajax: anObject ] ! alert: aString ^ window alert: aString ! confirm: aString ^ window confirm: aString ! newXhr ^ XMLHttpRequest new ! prompt: aString ^ window prompt: aString ! prompt: aString default: defaultString ^ window prompt: aString default: defaultString ! ! !BrowserInterface methodsFor: 'testing'! isAvailable ! ! Object subclass: #BrowserTerminal instanceVariableNames: '' package: 'Platform-Browser'! !BrowserTerminal commentStamp! I am `Terminal` service implementation for browser.! !BrowserTerminal methodsFor: 'actions'! alert: aString ^ window alert: aString ! confirm: aString ^ window confirm: aString ! prompt: aString ^ window prompt: aString ! prompt: aString default: defaultString ^ window prompt: aString default: defaultString ! ! !BrowserTerminal class methodsFor: 'testing'! initialize self isFeasible ifTrue: [ Terminal registerIfNone: self new ] ! isFeasible ! ! !Object methodsFor: '*Platform-Browser'! postMessageTo: aFrame ^ self postMessageTo: aFrame origin: '*' ! postMessageTo: aFrame origin: aString ! !