1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- Smalltalk createPackage: 'Platform-Browser'!
- (Smalltalk packageAt: 'Platform-Browser' ifAbsent: [ self error: 'Package not created: Platform-Browser' ]) imports: {'amber/core/Platform-Services'}!
- Object subclass: #BrowserPlatform
- slots: {}
- package: 'Platform-Browser'!
- !BrowserPlatform commentStamp!
- I am `Platform` service implementation for browser.!
- !BrowserPlatform methodsFor: 'accessing'!
- globals
- ^ window
- !
- newXhr
- XMLHttpRequest
- ifNotNil: [ ^ NativeFunction constructorOf: XMLHttpRequest ]
- ifNil: [ self error: 'XMLHttpRequest not available.' ]
- ! !
- !BrowserPlatform class methodsFor: 'testing'!
- initialize
- self isFeasible ifTrue: [ Platform registerIfNone: self new ]
- !
- isFeasible
- <inlineJS: 'return typeof window !!== "undefined"'>
- ! !
- Object subclass: #BrowserTerminal
- slots: {}
- 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
- <inlineJS: 'return typeof window !!== "undefined"'>
- ! !
- !Object methodsFor: '*Platform-Browser'!
- postMessageTo: aFrame
- ^ self postMessageTo: aFrame origin: '*'
- !
- postMessageTo: aFrame origin: aString
- <inlineJS: 'return aFrame.postMessage(self, aString)'>
- ! !
|