electron-notifications
Version:
A node module for sending notifications in electron applications
25 lines (20 loc) • 608 B
JavaScript
const electron = require('electron')
const EventEmitter = require('events')
const { remote } = electron
class SwipeRightBehavior extends EventEmitter {
constructor () {
super()
this.mainWindow = remote.getCurrentWindow()
this.xLeader = this.mainWindow.getPosition()[0]
this.xFollower = this.xLeader
this.mainWindow.on('move', this.move.bind(this))
}
move () {
this.xFollower = this.xLeader
this.xLeader = this.mainWindow.getPosition()[0]
if (this.xFollower < this.xLeader) {
this.emit('behavior', 'swipedRight')
}
}
}
module.exports = SwipeRightBehavior