Skip to content

Instantly share code, notes, and snippets.

@hachesilva
Created April 3, 2017 21:48
Show Gist options
  • Save hachesilva/2a85e83588a833f5be55ecaedfd4a3a4 to your computer and use it in GitHub Desktop.
Save hachesilva/2a85e83588a833f5be55ecaedfd4a3a4 to your computer and use it in GitHub Desktop.
Js boiler
+ function($) {
"use strict";
var StyleEditor = function() {
this.someState = false;
this.config = {
sideNavSelector: '.se__side-drawer',
secondaryDrawers: [
'.se__settings__theme-library',
'.se__settings__edit-palette'
]
};
this.initialize();
};
StyleEditor.prototype.initialize = function() {
var self = this;
self.someState = true;
self.attachEvents();
};
StyleEditor.prototype.getSettings = function(message) {
$(message).request(requestHandler, {
complete: function(data) {
self.openComponent(data);
},
error: function(jqXHR, status, error) {
console.error('error');
}
});
};
StyleEditor.prototype.openComponent = function(data) {
console.log(data.message);
};
StyleEditor.prototype.attachEvents = function() {
var self = this;
var $body = $('body');
// Open theme library
$body.on({
click: function(e) {
e.preventDefault();
self.getSettings();
}
},'.se__theme-preview');
};
// New instance
$(document).ready(function() {
if (window.StyleEditor === undefined) {
window.StyleEditor = new StyleEditor();
}
});
}(window.jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment