Updated Branches: refs/heads/master 2fe9fcabf -> 396b9faf3
[CB-364] added utils.log method which will console.log if available or, if not, alert a message Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/396b9faf Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/396b9faf Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/396b9faf Branch: refs/heads/master Commit: 396b9faf3fe0319e5933129ec9f94fc1db5c49a0 Parents: 2fe9fca Author: Fil Maj <[email protected]> Authored: Sun Mar 25 17:25:27 2012 -0700 Committer: Fil Maj <[email protected]> Committed: Sun Mar 25 17:25:27 2012 -0700 ---------------------------------------------------------------------- lib/common/utils.js | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/396b9faf/lib/common/utils.js ---------------------------------------------------------------------- diff --git a/lib/common/utils.js b/lib/common/utils.js index 49f6093..30a41d8 100644 --- a/lib/common/utils.js +++ b/lib/common/utils.js @@ -87,8 +87,18 @@ var _self = { Child.__super__ = Parent.prototype; Child.prototype.constructor = Child; }; - }()) + }()), + /** + * Logs a message in any available way: console.log or alert. + */ + log:function(msg) { + if (console && console.log) { + console.log(msg); + } else if (alert) { + alert(msg); + } + } }; module.exports = _self;
