Skip to content

Instantly share code, notes, and snippets.

@acidjazz
Created July 18, 2013 02:27
Show Gist options
  • Save acidjazz/6026257 to your computer and use it in GitHub Desktop.
Save acidjazz/6026257 to your computer and use it in GitHub Desktop.
function Drawer() {
this.listeners = {
"init": [],
"close": [],
"open": [],
"select": []
}
var self = this;
cordova.exec(function(evt) {
if (self.listeners[evt.action]) {
self.listeners[evt.action].forEach(function(l) {
l(evt.param);
});
}
}, function(err) {}, 'NavDrawerPlugin', 'init', []);
}
Drawer.prototype.on = function(evt, listener) {
this.listeners[evt].push(listener);
}
Drawer.prototype.openDrawer = function(success, failure) {
cordova.exec(success, failure, 'NavDrawerPlugin', 'openDrawer', []);
};
Drawer.prototype.closeDrawer = function(success, failure) {
cordova.exec(success, failure, 'NavDrawerPlugin', 'closeDrawer', []);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment