duhaime
duhaime

Reputation: 27611

JavaScript: Trigger event when value is logged to the console

I'm working with some blackbox minified/obscured javascript that runs console.log('hoyo') when it's ready for action.

I'd like to trigger an event when that value is logged to the console (I know this is bootleg). Is it possible to do so? Any advice would be helpful!

Upvotes: 1

Views: 740

Answers (1)

Tom
Tom

Reputation: 263

Is overriding console.log a possibility? Like here:

var og = console.log;

console.log = function(arg) {
  if (arg == 'heyo') alert('send the missles!');
  og(arg);
}

ps. not enough rep to post it as a comment...

Upvotes: 2

Related Questions