简体   繁体   中英

How do I use Meteor.js browser Javascript Console?

Launching new Meteor.js project. In client.js I put

var hi = "widget";

    if (Meteor.isClient()){
    ...
    }

In my Browser's Console, and I type:

>> hi
ReferenceError: hi is not defined
>> this.hi
undefined

It is probably locally scoped.

Try:

var global = Function("return this")();
global.hi = "widget";

Okay, this has changed just recently in version 0.6 and seems to be just a bug. If you remove var at the declaration of hi, the scope of the variable will change and it will become accessible via JS console. Still, it's a temporary situation, which will be likely be fixed in the future releases.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM