1
0

Platform-Node.st 583 B

1234567891011121314151617181920212223242526272829
  1. Smalltalk createPackage: 'Platform-Node'!
  2. Object subclass: #NodePlatform
  3. instanceVariableNames: ''
  4. package: 'Platform-Node'!
  5. !NodePlatform commentStamp!
  6. I am `Platform` service implementation for node-like environment.!
  7. !NodePlatform methodsFor: 'accessing'!
  8. globals
  9. ^ global
  10. !
  11. newXhr
  12. XMLHttpRequest
  13. ifNotNil: [ ^ XMLHttpRequest new ]
  14. ifNil: [ self error: 'XMLHttpRequest not available.' ]
  15. ! !
  16. !NodePlatform class methodsFor: 'testing'!
  17. initialize
  18. self isFeasible ifTrue: [ Platform registerIfNone: self new ]
  19. !
  20. isFeasible
  21. <return typeof global !!== "undefined">
  22. ! !