Reputation: 39298
Sorry for the weirdification of the wording in question. Feel free to improve but, please, read and understand the intention of the question first. :)
Sometimes, when I code, a bug may happen to magically appear in my code (without me being involved, of course - it's like the immaculate conception so to speak). In most cases, one just corrects the error in the code and uploads the source. Poof, problem's gone!
But sometimes, the evil computer will persist at developing new unwanted behavior based on the new code and in some rare occasion (i.e. pretty much always), I end up in trial and horror, uploading a gazillion times over.
It occurs to me that it'd be nice to be able to try out different inputs on client-side. At the moment I achieve that by making the regarded functions and variables global, as follows. This way I can access those from the console.
globoTheHolder = {};
globoTheHolder.doing = function(input) { ... }
globoTheHolder.knowing = "knowing nothing";
However, I'd like to know if (and in such case how) I can access a function declared the usual way, i.e. in the SCRIPT tag or linked to the rendered HTML file from a JS file.
Upvotes: 0
Views: 58
Reputation: 8671
By "try out different inputs on client-side" I assume you mean something like:
var v1 = {
buggy_function: function ()
// ...
};
var v2 = {
buggy_function: function ()
// ...
};
so that you could upload your code only once and then try v1.buggy_function()
or v2.buggy_function()
as you see fit. Is that so?
Well frankly I don't think you will find a tool to automate this.
You can copy-paste bits of code into the console to redefine variables or even functions on the fly, but that's about it, and it seems a terribly awkward way of doing things to me.
I don't understand your need for sparing you "gazillions" of uploads to begin with.
Don't you have a local apache serving a dev version of your site on localhost? Or is it the fear of getting blisters from the F5 key?
Installing Apache on your computer seems the pretty obvious solution to me: hello Mr localhost, bye bye Mr globoTheHolder.
Or am I missing something?
Upvotes: 1