Firebase 3.6.2 Web SDK missing "use strict" - javascript

I was trying to get a web app up and running and followed a very straightforward tutorial from Firebase. The link is pasted as a comment below.
The webpage, upon being loaded in Google Chrome, does not behave according to the tutorial. You are supposed to be able to change the value at a location specified at the child node "text" of my Firebase database and the webpage ought to update the text of a to reflect the change of the database. It doesn't. Dreamweaver tells me I'm forgetting the "use strict"; line in Firebase.js
I was wondering if anybody had any idea why this was? I imagine I'm making an obvious mistake somewhere.
I've also included screenshots of the error and my source code. I appreciate any help!
Thanks!
error from Firebase.js
my source code

Dreamweaver runs a linter on all code and the 'use strict' warning is a red herring for your problem. Code without 'use strict' isn't going to break anything so ignore it. If you find the warning distracting, you can disable it in Dreamweaver.
Anyway, if something isn't working in your app, you should be checking for errors in your browser's console log.
If your screenshot contains the entirety of your code, your problem might be that you're trying to set the innerText of a non-existent element, bigOne. This would present in the console as an error like "cannot set property innerText of undefined".

Related

How do I solve the ReferenceError in my API calls from my UI?

I have done a microsoft tutorial called Web API with Javascript
I now have a UI made with Javascript and HTML which looks like this:
How do I use the UI? I keep getting a Reference Error. Is there a specific syntax I am supposed to follow when I add and edit something via APIs?
In the future, please copy and paste error messages into your question. I would normally copy and paste the error message in my answer, but I don't want to type it all out :)
The errors (red) mean that you're trying to use JavaScript that is not defined yet. The warnings (yellow) are the reason why.
The second warning says that it could not load the JavaScript. That explains the errors. The first warning might be the reason why. It's saying that the MIME type is empty, when it should be application/javascript.
But you said in the comments that the site.js file is empty when you try to access it directly. Did you save all the JavaScript in step 4 of that tutorial to site.js?
And what are you using as a web server? IIS Express?

Not able to access variable in google chrome console

I am using the latest version of Meteor js. I am a newbie and couldn't find the solution. I have surfed for this problem a lot.
Before going to the problem, please have look at the directory structure first.
My directory structure of the project is like this :
\client
\main.html
\main.css
\main.js
\imports
\lib
\todos
\todos.js
\server
\main.js
I have created a Mongo Object in todos.js.
export const Todos = new Mongo.Collections('todos');
This is working fine.
Now in client\main.js, I am importing this object,
import { Todos } from '\imports\lib\todos\todos.js';
Note: I tried relative and absolute both type of addressing.
I put a debugger after that and checked and the variable is there. I can access that variable on the console. But as soon as I pass the statement and all the code is rendered on the browser(google chrome), I am not able to use Todos. It is giving me a ReferenceError. The error is
Todos is not defined.
I know there is no problem till the browser is loading because I checked that. I have surfed a lot. Please help me.
Thank you in advance.
Edit 1: I am using windows 7 if that is necessary.
As the comments above said, variables declared or imported in a file/module don't end up on the developers console.
What you can do to get stuff on the console is import it to the console using require
> require('/imports/lib/todos/todos.js')
Any valid absolute path or package will work here
Note: the path separators are always *nix style /
I had a similar problem while trying to evaluate moment from Moment.js in Chrome console. It was imported by the script being debugged/under breakpoints but does not work in console. import or require Moment.js in console gave me errors and did not work for me.
I ended up switching to Firefox Developer Edition, where I can put breakpoints and then evaluate moment in its console out of the box without any problems.

Error in Rails with JS code

Rails will not let me run JS code, I have these errors
1)
2)
whenever you add JS code, the errors appear.
Some idea why this happening?
Just because you're getting error highlights in your IDE, doesn't necessarily mean your code is wrong. Try running your server, navigate to your site from your browser, and check the developer console. Do you still see javascript errors?
This warning (it is not an error) is being displayed because your IDE thinks that the variable $ is not defined in your code. However, it is not able to find out that $ is a global variable defined in the jQuery library, imported a few lines before.
The IDE is just saying that the presence of that variable is not guaranteed unless you properly import the needed libraries to make it exist (jQuery in this case). Your code should work properly. In order to identify errors in your javascript code, I would recommend you to use the built in console in the web browser.

angularjs error in console log for jsfiddle

I am working on an Angular grid project and i am facing a minor error while using angular-grid.
Heres the error- Module 'angularGrid' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
So i thought i am missing out on something. I checked a JSfiddle and was not able to view the output there. So i checked the console for errors. here also the same error is displayed.
JSfiddle is not even edited by me. I am just viewing the link. Yet i get the same error.
http://jsfiddle.net/9b5gnjf1/8/
<md-toolbar class="md-whiteframe-z2">
<div class="md-toolbar-tools">Toolbar</div>
Just adding the above 2 lines from the link so that stackoverflow lets me paste the jsfiddle link. without any code written, it doesnot allow to post the link here.
anyone knows what kind of error is this and how to solve it ?
There's a 404 error resolving the external link to the javascript file that the angular-grid module lives in.
Looks like either it's a bad link, or the rawgit servers are down.
You can either wait and hope the link comes back to life, or replace the broken external resource with a working one.

How to load Component and its Classes in my website

I am trying to over ride one the notification popups of browser using the following code:
var branch = Components.classes["#mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
But in Mozilla Firefox, I get the error Component.classes is undefined.
And in Chrome Browser, I get the error Component is undefined.
Well I have realised I need to include something in my website. But I am unable to find exactly what is required.
Please anybody help. I googled about it a lot, but I have never used this thing before(the Classes) and I am unable to search what will help me out. i dont even have any idea that what will be the tags for this thing. I have never used Component or its classes
My website is in ZF2.
Components Object is non-standard feature. See https://developer.mozilla.org/en/docs/Components_object.
It also says
Warning: This object is only intended for code running with chrome
privileges. Exposing the object to regular web code was a mistake.

Categories