cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Grieve <agri...@google.com>
Subject Re: js commit: [All] patch, in case console.warn is not defined
Date Wed, 10 Jul 2013 02:55:16 GMT
Hey Jesse,

Not sure you meant to add in the window.external.Notify into the shared
code. Windows specific?

Also - why patch console.warn? We already have plugin-console, which
ensures all console methods are available, instead of just warn (
https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-console.git;a=blob;f=www/console-via-logger.js;h=4095eb3e6c98a5e0ba1fd6fed04d0183a823997d;hb=HEAD
).

Is it that warn is not available on WP? If not - maybe let's just make a
rule not to use .warn within CordovaJS?


On Tue, Jul 9, 2013 at 9:53 PM, <purplecabbage@apache.org> wrote:

> Updated Branches:
>   refs/heads/master 0ce471840 -> 984b1f1e2
>
>
> [All] patch, in case console.warn is not defined
>
>
> Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
> Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/984b1f1e
> Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/984b1f1e
> Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/984b1f1e
>
> Branch: refs/heads/master
> Commit: 984b1f1e26b12af2ad2acda96074341853ea8706
> Parents: 0ce4718
> Author: Jesse MacFadyen <purplecabbage@gmail.com>
> Authored: Tue Jul 9 18:53:02 2013 -0700
> Committer: Jesse MacFadyen <purplecabbage@gmail.com>
> Committed: Tue Jul 9 18:53:02 2013 -0700
>
> ----------------------------------------------------------------------
>  lib/cordova.js | 7 +++++++
>  1 file changed, 7 insertions(+)
> ----------------------------------------------------------------------
>
>
>
> http://git-wip-us.apache.org/repos/asf/cordova-js/blob/984b1f1e/lib/cordova.js
> ----------------------------------------------------------------------
> diff --git a/lib/cordova.js b/lib/cordova.js
> index 2bf49ab..0a566bb 100644
> --- a/lib/cordova.js
> +++ b/lib/cordova.js
> @@ -99,10 +99,17 @@ function createEvent(type, data) {
>  }
>
>  if(typeof window.console === "undefined") {
> +    window.external.Notify("console was undefined, in cordova.js fixing
> it.");
>      window.console = {
>          log:function(){}
>      };
>  }
> +// there are places in the framework where we call `warn` also, so we
> should make sure it exists
> +if(typeof window.console.warn === "undefined") {
> +    window.console.warn = function(msg) {
> +        this.log("warn: " + msg);
> +    }
> +}
>
>  var cordova = {
>      define:define,
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message