diff --git a/lib/core/events.js b/lib/core/events.js index ea6b84a5..6cdf945d 100644 --- a/lib/core/events.js +++ b/lib/core/events.js @@ -1,11 +1,32 @@ var EventEmitter = require('events'); +function warnIfLegacy(eventName) { + const legacyEvents = ['abi-vanila', 'abi', 'abi-contracts-vanila', 'abi-vanila-deployment']; + if (legacyEvents.indexOf(eventName) >= 0) { + console.warn("this event is deprecated and will be removed in future versions: " + eventName); + } +} + +const _on = EventEmitter.prototype.on; +const _setHandler = EventEmitter.prototype.setHandler; + +EventEmitter.prototype.on = function(requestName, cb) { + warnIfLegacy(requestName); + return _on.call(this, requestName, cb); +}; + +EventEmitter.prototype.setHandler = function(requestName, cb) { + warnIfLegacy(requestName); + return _setHandler.call(this, requestName, cb); +}; + EventEmitter.prototype.request = function(requestName, cb) { - this.emit('request:' + requestName, cb); + warnIfLegacy(requestName); + return this.emit('request:' + requestName, cb); }; EventEmitter.prototype.setCommandHandler = function(requestName, cb) { - this.on('request:' + requestName, function(_cb) { + return this.on('request:' + requestName, function(_cb) { cb.call(this, _cb); }); }; diff --git a/test_app/config/contracts.json b/test_app/config/contracts.json index 6e1a3ec2..4854af1c 100644 --- a/test_app/config/contracts.json +++ b/test_app/config/contracts.json @@ -1,7 +1,7 @@ { "default": { "versions": { - "web3.js": "1.0.0", + "web3.js": "0.20.0", "solc": "0.4.11" }, "deployment": {