bebraw
4/2/2010 - 5:39 PM

gistfile1.js

// usage:
// points = new Points()
// points.push('bar')
// points.push('foo')
// points[0] == 'bar'
// points[1] == 'foo'
// points.length == 2

function Points() {
    this.init();
}
Points.prototype = {
    init: function () {
        this.container = [];
        this.current = null;
        this.previous = null;
        this.length = 0;
    },
    destroy: function () {},
    push: function (item) {
        this.container.push(item);
        this.length++;

        this.previous = this.current;
        this.current = item;
    }
}