This repository has been archived on 2020-10-11. You can view files and clone it, but cannot push or open issues or pull requests.
angularjs-batarang/hint.js

39 lines
899 B
JavaScript
Raw Normal View History

/*
2014-10-24 14:03:45 +00:00
* Batarang instrumentation
*
* This gets loaded into the context of the app you are inspecting
*/
require('./loader.js');
2014-08-04 22:42:58 +00:00
require('angular-hint');
angular.hint.onMessage = function (moduleName, message, messageType, category) {
2014-10-17 00:52:53 +00:00
if (!message) {
message = moduleName;
moduleName = 'Unknown'
}
if (typeof messageType === 'undefined') {
messageType = 1;
}
sendMessage({
2014-10-17 00:52:53 +00:00
module: moduleName,
message: message,
severity: messageType,
category: category
2014-10-17 00:52:53 +00:00
});
};
angular.hint.emit = function (ev, data) {
data.event = ev;
sendMessage(data);
};
var eventProxyElement = document.getElementById('__ngBatarangElement');
var customEvent = document.createEvent('Event');
customEvent.initEvent('batarangDataEvent', true, true);
function sendMessage (obj) {
eventProxyElement.innerText = JSON.stringify(obj);
eventProxyElement.dispatchEvent(customEvent);
}