electron/browser/api/lib/window.coffee

27 lines
1.1 KiB
CoffeeScript
Raw Normal View History

EventEmitter = require('events').EventEmitter
Window = process.atom_binding('window').Window
Window.prototype.__proto__ = EventEmitter.prototype
# Convient accessors.
setupGetterAndSetter = (constructor, name, getter, setter) ->
2013-04-18 16:06:10 +00:00
if getter?
constructor.prototype.__defineGetter__ name, ->
this[getter].apply(this, arguments)
if setter?
constructor.prototype.__defineSetter__ name, ->
this[setter].apply(this, arguments)
setupGetterAndSetter Window, 'fullscreen', 'isFullscreen', 'setFullscreen'
setupGetterAndSetter Window, 'size', 'getSize', 'setSize'
setupGetterAndSetter Window, 'maximumSize', 'getMaximumSize', 'setMaximumSize'
setupGetterAndSetter Window, 'minimumSize', 'getMinimumSize', 'setMinimumSize'
setupGetterAndSetter Window, 'resizable', 'isResizable', 'setResizable'
setupGetterAndSetter Window, 'alwaysOnTop', 'isAlwaysOnTop', 'setAlwaysOnTop'
setupGetterAndSetter Window, 'position', 'getPosition', 'setPosition'
setupGetterAndSetter Window, 'title', 'getTitle', 'setTitle'
setupGetterAndSetter Window, 'kiosk', 'isKiosk', 'setKiosk'
2013-04-18 16:06:10 +00:00
setupGetterAndSetter Window, 'url', 'getURL', 'loadURL'
module.exports = Window