service.pending = [];
service.socket = null;
service.hatchAvailable = null;
- service.hatchURL = 'ws://localhost:8080/hatch/'; // TODO: configuration/ssl
+ service.hatchURL = 'wss://localhost:8443/hatch';
service.hatchSend = function(msg) {
}
var srcMsg = service.messages[msgObj.msgid];
- delete service.messages[msgObj.msgid];
- srcMsg.deferred.resolve(msgObj);
+ if (srcMsg) {
+ delete service.messages[msgObj.msgid];
+ srcMsg.deferred.resolve(msgObj);
+ }
}
}
- service.browserPrint = function(mime, data) {
+ service.browserPrint = function(contentType, content) {
// let our local print container handle printing
- service.onBrowserPrint(mime, data);
+ service.onBrowserPrint(contentType, content);
}
- service.print = function(mime, data) {
+ service.print = function(contentType, content) {
if (service.hatchAvailable === false) {
- service.browserPrint(mime, data);
+ service.browserPrint(contentType, content);
return $q.when();
}
return service.hatchSend({
key : 'no-op',
action : 'print',
- mime : mime,
- value : data,
+ content : content,
+ contentType : contentType
//printer : printer // TODO: prefs, etc.
});
}