neft
Version:
Universal Platform
27 lines (22 loc) • 725 B
text/coffeescript
module.exports = (impl) ->
initScreenNamespace: ->
screen = @
= screen.width
= screen.height
= 'ontouchstart' of window
getOrientation = =>
screen.orientation = switch window.orientation
when 180
'InvertedPortrait'
when -90
'Landscape'
when 90
'InvertedLandscape'
else
'Portrait'
return
window.addEventListener 'orientationchange', getOrientation
window.addEventListener 'load', ->
getOrientation()
setTimeout getOrientation, 1000