Download code/test/JavaScript/0036800_swipeRightBehavior.js from Variable-role/sajaniemi_variable_dataset_large: direct link, hf CLI and curl.
- Browser
- Download file 608 Bytes
-
https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/code/test/JavaScript/0036800_swipeRightBehavior.js
- Command line
-
hf download hf://datasets/Variable-role/sajaniemi_variable_dataset_large/code/test/JavaScript/0036800_swipeRightBehavior.js
-
curl -L -o 0036800_swipeRightBehavior.js https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/code/test/JavaScript/0036800_swipeRightBehavior.js
608 Bytes
| 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 | |