Skip to content

Commit

Permalink
console.log is not always accessible in IE
Browse files Browse the repository at this point in the history
  • Loading branch information
sakren committed Nov 26, 2013
1 parent 026a84e commit 1f75c51
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 10 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,9 @@ $ npm test

## Changelog

* 1.7.1
+ Potential bug in IE

* 1.7.0
+ Updated dependencies
+ Added `injectMethods` to services
Expand Down
4 changes: 2 additions & 2 deletions lib/DI.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions lib/Helpers.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "dependency-injection",
"description": "Dependency injection with configuration and autowire for node js and browser",
"version": "1.7.0",
"version": "1.7.1",
"author": {
"name": "David Kudera",
"email": "sakren@gmail.com"
Expand Down
4 changes: 2 additions & 2 deletions src/DI.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class DI

# deprecated
autowireArguments: (method, args = []) ->
console.log 'Method autowireArguments is deprecated, use the same method in Helpers class.'
Helpers.log 'Method autowireArguments is deprecated, use the same method in Helpers class.'
return Helpers.autowireArguments(method, args, @)


Expand Down Expand Up @@ -74,7 +74,7 @@ class DI

# deprecated
getByName: (name) ->
console.log 'DI: Method getByName is deprecated, use get method.'
Helpers.log 'DI: Method getByName is deprecated, use get method.'
return @get(name)


Expand Down
5 changes: 5 additions & 0 deletions src/Helpers.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ class Helpers
return result


@log: (message) ->
if console?.log?
console.log(message)


@arrayIndexOf: (array, search) ->
if typeof Array.prototype.indexOf != 'undefined'
return array.indexOf(search)
Expand Down
20 changes: 15 additions & 5 deletions test/browser/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
parent: null,
children: null
};
modules[fullName].apply(modules[fullName], [m.exports, m]);
modules[fullName].apply(window, [m.exports, m]);
m.loaded = true;
cache[fullName] = m;
}
Expand Down Expand Up @@ -321,6 +321,12 @@
return result;
};

Helpers.log = function(message) {
if ((typeof console !== "undefined" && console !== null ? console.log : void 0) != null) {
return console.log(message);
}
};

Helpers.arrayIndexOf = function(array, search) {
var element, i, _i, _len;
if (typeof Array.prototype.indexOf !== 'undefined') {
Expand Down Expand Up @@ -1570,7 +1576,7 @@
return {
"name": "dependency-injection",
"description": "Dependency injection with configuration and autowire for node js and browser",
"version": "1.7.0",
"version": "1.7.1",
"author": {
"name": "David Kudera",
"email": "sakren@gmail.com"
Expand Down Expand Up @@ -1659,7 +1665,11 @@
},
"homepage": "https://github.com/sakren/node-easy-configuration",
"_id": "easy-configuration@1.6.6",
"_from": "easy-configuration@~1.6.6"
"dist": {
"shasum": "db0587409da1302eaefac9c89e1a752d1df18ada"
},
"_from": "easy-configuration@~1.6.6",
"_resolved": "https://registry.npmjs.org/easy-configuration/-/easy-configuration-1.6.6.tgz"
}

}).call(this);
Expand All @@ -1669,8 +1679,8 @@
, 'recursive-merge': function(exports, module) { module.exports = window.require('recursive-merge/lib/Merge.js'); }

});
require.__setStats({"/lib/Service.js":{"atime":1385411968000,"mtime":1385411929000,"ctime":1385411929000},"/lib/Helpers.js":{"atime":1385411968000,"mtime":1385411929000,"ctime":1385411929000},"/lib/DI.js":{"atime":1385411968000,"mtime":1385411929000,"ctime":1385411929000},"easy-configuration/lib/EasyConfiguration.js":{"atime":1385411968000,"mtime":1385411214000,"ctime":1385411940000},"recursive-merge/lib/Merge.js":{"atime":1385411968000,"mtime":1385409966000,"ctime":1385411941000},"easy-configuration/lib/Extension.js":{"atime":1385411968000,"mtime":1385411214000,"ctime":1385411940000},"easy-configuration/lib/Helpers.js":{"atime":1385411968000,"mtime":1385411214000,"ctime":1385411940000},"/test/browser/tests/DI.coffee":{"atime":1385377202000,"mtime":1385377199000,"ctime":1385377199000},"/test/browser/tests/Helpers.coffee":{"atime":1385375714000,"mtime":1385375712000,"ctime":1385375712000},"/lib/DIConfigurator.js":{"atime":1385411968000,"mtime":1385411929000,"ctime":1385411929000},"/test/data/Application.coffee":{"atime":1385367948000,"mtime":1385367948000,"ctime":1385367948000},"/test/data/Http.coffee":{"atime":1385411960000,"mtime":1385309217000,"ctime":1385309217000},"/package.json":{"atime":1385411890000,"mtime":1385411889000,"ctime":1385411889000},"easy-configuration/package.json":{"atime":1385411968000,"mtime":1385411940000,"ctime":1385411940000}});
require.version = '5.1.2';
require.__setStats({"/lib/Service.js":{"atime":1385450842000,"mtime":1385450834000,"ctime":1385450834000},"/lib/Helpers.js":{"atime":1385451171000,"mtime":1385451134000,"ctime":1385451134000},"/lib/DI.js":{"atime":1385450842000,"mtime":1385450834000,"ctime":1385450834000},"easy-configuration/lib/EasyConfiguration.js":{"atime":1385451228000,"mtime":1385411214000,"ctime":1385450928000},"recursive-merge/lib/Merge.js":{"atime":1385451229000,"mtime":1385409966000,"ctime":1385450932000},"easy-configuration/lib/Extension.js":{"atime":1385451229000,"mtime":1385411214000,"ctime":1385450928000},"easy-configuration/lib/Helpers.js":{"atime":1385451229000,"mtime":1385411214000,"ctime":1385450928000},"/test/browser/tests/DI.coffee":{"atime":1385450794000,"mtime":1385450793000,"ctime":1385450793000},"/test/browser/tests/Helpers.coffee":{"atime":1385450794000,"mtime":1385450793000,"ctime":1385450793000},"/lib/DIConfigurator.js":{"atime":1385450842000,"mtime":1385450834000,"ctime":1385450834000},"/test/data/Application.coffee":{"atime":1385450794000,"mtime":1385450793000,"ctime":1385450793000},"/test/data/Http.coffee":{"atime":1385450855000,"mtime":1384940373000,"ctime":1384940373000},"/package.json":{"atime":1385451227000,"mtime":1385451225000,"ctime":1385451225000},"easy-configuration/package.json":{"atime":1385450943000,"mtime":1385450929000,"ctime":1385450929000}});
require.version = '5.1.3';

/** run section **/

Expand Down

0 comments on commit 1f75c51

Please sign in to comment.