Download wp-calypso/desktop/app/lib/platform/mac/index.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.66 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/desktop/app/lib/platform/mac/index.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/desktop/app/lib/platform/mac/index.js
-
curl -L -o index.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/desktop/app/lib/platform/mac/index.js
1.66 kB
| const { app, Menu } = require( 'electron' ); | |
| const appQuit = require( '../../../lib/app-quit' ); | |
| const log = require( '../../../lib/logger' )( 'platform:mac' ); | |
| const menuSetter = require( '../../../lib/menu-setter' ); | |
| let window; | |
| let dockMenu; | |
| function MacPlatform( appWindow ) { | |
| window = appWindow.window; | |
| dockMenu = Menu.buildFromTemplate( require( './dock-menu' )( app, appWindow ) ); | |
| app.dock.setMenu( dockMenu ); | |
| app.on( 'activate', function () { | |
| window.show(); | |
| window.focus(); | |
| } ); | |
| app.on( 'window-all-closed', function () { | |
| log.info( 'All windows closed, shutting down' ); | |
| app.quit(); | |
| } ); | |
| app.on( 'before-quit', function () { | |
| log.info( 'Application quit triggered' ); | |
| appQuit.allowQuit(); | |
| } ); | |
| window.on( 'close', function ( ev ) { | |
| if ( appQuit.shouldQuitToBackground() ) { | |
| log.info( `User clicked 'close': hiding main window...` ); | |
| ev.preventDefault(); | |
| window.hide(); | |
| appWindow.view.webContents.send( 'notifications-panel-show', false ); | |
| } | |
| } ); | |
| } | |
| MacPlatform.prototype.restore = function () { | |
| if ( window.isMinimized() ) { | |
| window.restore(); | |
| } | |
| window.show(); | |
| }; | |
| MacPlatform.prototype.showNotificationsBadge = function ( count, bounce ) { | |
| const badgeCount = app.getBadgeCount(); | |
| if ( count === badgeCount ) { | |
| return; | |
| } | |
| app.setBadgeCount( count ); | |
| const shouldBounce = bounce && count > badgeCount; | |
| if ( shouldBounce ) { | |
| app.dock.bounce(); | |
| } | |
| }; | |
| MacPlatform.prototype.clearNotificationsBadge = function () { | |
| app.setBadgeCount( 0 ); | |
| }; | |
| MacPlatform.prototype.setDockMenu = function ( enabled ) { | |
| menuSetter.setRequiresUser( dockMenu, enabled ); | |
| }; | |
| module.exports = MacPlatform; | |