w3future.com

Beyond JS

A javascript library

The game

*Check the box to let the star follow your cursor. It will circle the position of your cursor when it moves with a 1 second delay. Now try to move your cursor in such a way that the star staysat about the same position.

Last Update

10/16/2005; 1:22:09 AM

Try XHTML 2.0
Src XHTML 2.0
RDF Metadata


Site Colors

Syn Atom 1.0
Syn RSS 0.91
Syn Subscribe

CC Licensed
Geo URL
With Radio

Download

Beyond JS v1.0

What is Beyond JS

Beyond JS is a Javascript library that lets you write Javascript unlike anything you've ever written. Your code will never be the same again. It contains both useful, functional, tricky and freakish extentions and additions to Javascript. It can make your code more readable and less debugable, and even the other way around.

It started with a trick, my funclib.js and a mail from Dan Shappir, which resulted in this article. Since then new versions of the library have been sent to and fro between me and Dan. We had great fun, and the library grew with each new idea. Now we felt it was time for others to try the code. We try to support IE4+ and Mozilla. But we've not yet tested very much, there might even be some completely untested code in there.

Example

In the right sidebar you find a little 'game'. Here's the code, which shows some of the important functions of the library: curry, using and Function.from.

document.body.onmousemove = Function.from("star", "moveTo").delay(1000).using(
  "+".using(
    Function.from(event, ×), 
    "*".using("radius", Function.from(Math, "sin", "angle"))),
  "+".using(
    Function.from(event, "y"), 
    "*".using("radius", Function.from(Math, "cos", "angle")))
).curry({
  radius: 30, 
  angle: function() {return (new Date)/50;}.asValue()
}).gate(Function.from("doStar".element(),"checked"));

(The example doesn't work with Mozilla, because of the differences in event handling. BeyondJS is cross-platform.)