JavaScript Simple Query Object
Every programming language and scripting language supports SQLite, but javascript doesn’t! Internet Explorer has an activeX feature for javascript that gives SQLite availability, but that still left firefox, safari and google chrome without. Javascript Simple Query Object is an attempt to add SQL-like abilities to javascript. It’s kinda just a jar of data. I wanted to make it just work with an SQL language, but that would have been slower, so I just make it work with hash arrays of data.
The JSQO can insert, delete, select and update the data that is inside it’s jar. Since it’s very losely made, it shouldn’t be a bruiser on speeds. That still leaves the issue of no real error handling, which is a problem in javascript all together.
Test.html shows everything you really need to know about using the simple query object. Yes, I know it would be more convient to type out “select * from BLEH where GRRR = ‘hell’”, but that would require lots and lots of coding. No one wants to have a 1mb javascript file on their site.
- It’s lightweight! (Both in how it’s coded and how small it is!)
- It’s designed with people that use SQL in mind.
- It’s free….. you can’t hate something that’s released under the MIT License.
Download [v1.0.0 Final] (JSQO.zip 3kb)
JSequencer
As we all know, javascript doesn’t have any way of multithreading, unless you abuse frames. I’ve popped out a solution that has been used by other people, but in a more idiot friendly way. It has been tested in Firefox 2, IE 7, and Google Chrome Beta. The thing comes with an example of it at work. The way it works is:
You call jsequencer.init(function, variables)….. example: jsequencer.init(function(e){ //… code here }, {‘var1′ : ‘value1′, ‘var2′ : ‘value2′})
When you call jsequencer.init, it’ll automatically start running the function. Notice the variable “e” in the function definition. That will be all our variables. Our variables would be used like “e.var1″ or “e['var1']“. It’s pretty straight forward.
Specially returned values of “e” would be TimerPercent(optional Int). The optional INT will override the variable “endTime”. endTime or the optional Int is calculated in miliseconds. The function would be called like “e.TimerPercent(10000)” (that checks 10 seconds). The return would bring back a percentage for how many seconds of 10 seconds has passed since the action started.
To end your initiation of an action, just return a false value.
This is licensed under the MIT License.
Download Now [v1.0.0 Final] (JSenquencer.zip 2kb)