Skip to content

Instantly share code, notes, and snippets.

@MiraiSubject
Last active July 18, 2016 14:34
Show Gist options
  • Select an option

  • Save MiraiSubject/c1b2c79db929c73ca3876ef4b59f90fe to your computer and use it in GitHub Desktop.

Select an option

Save MiraiSubject/c1b2c79db929c73ca3876ef4b59f90fe to your computer and use it in GitHub Desktop.
jQuery Electron
const minimizeButton = document.getElementById('min-btn');
const maximizeButton = document.getElementById('max-btn');
const closeButton = document.getElementById('close-btn');
const remote = require('electron').remote;
minimizeButton.addEventListener('click', function (event) {
console.info('lol');
var window = remote.getCurrentWindow();
window.minimize();
});
maximizeButton.addEventListener('click', function (event) {
var window = remote.getCurrentWindow();
if (!window.isMaximized()) {
window.maximize();
} else {
window.unmaximize();
}
});
closeButton.addEventListener('click', function (event) {
var window = remote.getCurrentWindow();
window.close();
});
const $ = require('jquery');
$(function(){
'use strict';
var $page = $('#main'),
options = {
debug: true,
prefetch: true,
cacheLength: 4,
onStart: {
duration: 100, // Duration of our animation
render: function ($container) {
// Add your CSS animation reversing class
$container.addClass('is-exiting');
// Restart your animation
smoothState.restartCSSAnimations();
}
},
onReady: {
duration: 0,
render: function ($container, $newContent) {
// Remove your CSS animation reversing class
$container.removeClass('is-exiting');
// Inject the new content
$container.html($newContent);
}
}
},
smoothState = $page.smoothState(options).data('smoothState');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment