Permalink
Browse files

Version 0.4 release

  • Loading branch information...
iros committed Nov 16, 2012
1 parent 2c8e9fa commit 9da412493e4775deb55e1c723f713de49b1d12b7
View
@@ -11,25 +11,25 @@ All downloads are located in the [/dist](https://github.com/misoproject/dataset/
### Including Dependencies
-[miso.ds.dev.0.3.0.zip](https://github.com/downloads/misoproject/dataset/miso.ds.dev.0.3.0.zip) - Download Development With Dependencies - 0.3.0
+[miso.ds.dev.0.4.0.zip](https://github.com/downloads/misoproject/dataset/miso.ds.dev.0.4.0.zip) - Download Development With Dependencies - 0.3.0
-[miso.ds.deps.min.0.3.0.js](https://github.com/downloads/misoproject/dataset/miso.ds.deps.min.0.3.0.js) - Download Production With Dependencies - 0.3.0
+[miso.ds.deps.min.0.3.0.js](https://github.com/downloads/misoproject/dataset/miso.ds.deps.min.0.4.0.js) - Download Production With Dependencies - 0.4.0
-[miso.ds.deps.ie.0.3.0.js](https://github.com/downloads/misoproject/dataset/miso.ds.deps.ie.0.3.0.js) - Download Development With Dependencies for IE - 0.3.0
+[miso.ds.deps.ie.0.4.0.js](https://github.com/downloads/misoproject/dataset/miso.ds.deps.ie.0.4.0.js) - Download Development With Dependencies for IE - 0.4.0
-[miso.ds.deps.ie.min.0.3.0.js](https://github.com/downloads/misoproject/dataset/miso.ds.deps.ie.0.3.0.js) - Download Production With Dependencies for IE - 0.3.0
+[miso.ds.deps.ie.min.0.4.0.js](https://github.com/downloads/misoproject/dataset/miso.ds.deps.ie.0.4.0.js) - Download Production With Dependencies for IE - 0.4.0
### Without Dependencies
The following builds do not have any of the dependencies built in. It is your own responsibility to include them as appropriate script elements in your page.
-[miso.ds.0.3.0.js](https://github.com/downloads/misoproject/dataset/miso.ds.0.3.0.js) - Download Development No Dependencies - 0.3.0
+[miso.ds.0.4.0.js](https://github.com/downloads/misoproject/dataset/miso.ds.0.4.0.js) - Download Development No Dependencies - 0.4.0
-[miso.ds.min.0.3.0.js](https://github.com/misoproject/dataset/tree/master/dist/miso.ds.min.0.3.0.js) - Download Production No Dependencies - 0.3.0
+[miso.ds.min.0.4.0.js](https://github.com/misoproject/dataset/tree/master/dist/miso.ds.min.0.4.0.js) - Download Production No Dependencies - 0.4.0
-[miso.ds.0.3.0.m.js](https://github.com/misoproject/dataset/tree/master/dist/miso.ds.0.3.0.m.js) - Download AMD Compatibile Build No Dependencies- 0.3.0
+[miso.ds.0.4.0.m.js](https://github.com/misoproject/dataset/tree/master/dist/miso.ds.0.4.0.m.js) - Download AMD Compatibile Build No Dependencies- 0.4.0
-[miso.ds.min.0.3.0.m.js](https://github.com/misoproject/dataset/tree/master/dist/miso.ds.min.0.3.0.m.js) - Download AMD Compatibile Build Production No Dependencies- 0.3.0
+[miso.ds.min.0.4.0.m.js](https://github.com/misoproject/dataset/tree/master/dist/miso.ds.min.0.4.0.m.js) - Download AMD Compatibile Build Production No Dependencies- 0.4.0
### Dependencies
@@ -40,6 +40,7 @@ Dataset has the following dependencies:
* [Underscore.math.js (version unknown)](https://github.com/syntagmatic/underscore.math)
* [Underscore.deferred.js 0.2.0](https://github.com/wookiehangover/underscore.Deferred)
* [moment.js 1.7.2](http://momentjs.com/) (for date and time parsing)
+* [miso.events.js 0.0.1](http://github.com/misoproject/events) (For adding event behavior)
If you are planning on supporting IE, include the following json2.js library as well:
* [json2.js 2011-10-19](https://github.com/douglascrockford/JSON-js)
View
@@ -1 +0,0 @@
-2012/10/27 04:34
@@ -1,5 +1,5 @@
/**
-* Miso.Dataset - v0.3.0 - 10/27/2012
+* Miso.Dataset - v0.4.0 - 11/16/2012
* http://github.com/misoproject/dataset
* Copyright (c) 2012 Alex Graul, Irene Ros;
* Dual Licensed: MIT, GPL
@@ -57,6 +57,7 @@
(function(global, _) {
+ var Miso = global.Miso || (global.Miso = {});
var Dataset = global.Miso.Dataset;
/**
@@ -216,7 +217,7 @@
// is this a syncable dataset? if so, pull
// required methoMiso and mark this as a syncable dataset.
if (this.parent.syncable === true) {
- _.extend(this, Dataset.Events);
+ _.extend(this, Miso.Events);
this.syncable = true;
}
@@ -235,7 +236,7 @@
// bind to parent if syncable
if (this.syncable) {
- this.parent.bind("change", this._sync, this);
+ this.parent.subscribe("change", this._sync, { context : this });
}
},
@@ -309,8 +310,8 @@
// trigger any subscribers
if (this.syncable) {
- this.trigger(eventType, event);
- this.trigger("change", event);
+ this.publish(eventType, event);
+ this.publish("change", event);
}
},
@@ -569,7 +570,7 @@
return this;
},
- _add : function(row, options) {
+ _add : function(row) {
// first coerce all the values appropriatly
_.each(row, function(value, key) {
@@ -735,7 +736,7 @@
}
if (this.syncable && !options.silent) {
- this.trigger("sort");
+ this.publish("sort");
}
return this;
@@ -766,6 +767,7 @@ Version 0.0.1.2
(function(global, _, moment) {
+ var Miso = global.Miso || (global.Miso = {});
var Dataset = global.Miso.Dataset;
// take on miso dataview's prototype
@@ -784,7 +786,7 @@ Version 0.0.1.2
// is this a syncable dataset? if so, pull
// required methods and mark this as a syncable dataset.
if (options.sync === true) {
- _.extend(this, Dataset.Events);
+ _.extend(this, Miso.Events);
this.syncable = true;
}
@@ -1212,9 +1214,9 @@ Version 0.0.1.2
}, this);
if (this.syncable && !options.silent) {
- var e = this._buildEvent(deltas, this);
- this.trigger('add', e );
- this.trigger('change', e );
+ var e = Dataset.Events._buildEvent(deltas, this);
+ this.publish('add', e );
+ this.publish('change', e );
}
return this;
@@ -1246,9 +1248,9 @@ Version 0.0.1.2
}, this);
if (this.syncable && (!options || !options.silent)) {
- var ev = this._buildEvent( deltas, this );
- this.trigger('remove', ev );
- this.trigger('change', ev );
+ var ev = Dataset.Events._buildEvent( deltas, this );
+ this.publish('remove', ev );
+ this.publish('change', ev );
}
},
@@ -1348,9 +1350,9 @@ Version 0.0.1.2
//computer column updates
//update triggers
if (this.syncable && (!options || !options.silent)) {
- var ev = this._buildEvent( deltas, this );
- this.trigger('update', ev );
- this.trigger('change', ev );
+ var ev = Dataset.Events._buildEvent( deltas, this );
+ this.publish('update', ev );
+ this.publish('change', ev );
}
return this;
},
@@ -1368,7 +1370,7 @@ Version 0.0.1.2
});
this.length = 0;
if (this.syncable && (!options || !options.silent)) {
- this.trigger("reset");
+ this.publish("reset");
}
}
@@ -1408,7 +1410,7 @@ Version 0.0.1.2
}
return v;
},
- test : function(v) {
+ test : function() {
return true;
},
compare : function(s1, s2) {
@@ -1571,7 +1573,7 @@ Version 0.0.1.2
// if string, then parse as a time
if (_.isString(v)) {
var format = options.format || this.format;
- return moment(v, options.format);
+ return moment(v, format);
} else if (_.isNumber(v)) {
return moment(v);
} else {
@@ -1686,86 +1688,11 @@ Version 0.0.1.2
//Event Related Methods
Dataset.Events = {};
- /**
- * Bind callbacks to dataset events
- * Parameters:
- * ev - name of the event
- * callback - callback function
- * context - context for the callback. optional.
- * Returns
- * object being bound to.
- */
- Dataset.Events.bind = function (ev, callback, context) {
- var calls = this._callbacks || (this._callbacks = {});
- var list = calls[ev] || (calls[ev] = {});
- var tail = list.tail || (list.tail = list.next = {});
- tail.callback = callback;
- tail.context = context;
- list.tail = tail.next = {};
- return this;
- };
-
- /**
- * Remove one or many callbacks. If `callback` is null, removes all
- * callbacks for the event. If `ev` is null, removes all bound callbacks
- * for all events.
- * Parameters:
- * ev - event name
- * callback - Optional. callback function to be removed
- * Returns:
- * The object being unbound from.
- */
- Dataset.Events.unbind = function(ev, callback) {
- var calls, node, prev;
- if (!ev) {
- this._callbacks = null;
- } else if (calls = this._callbacks) {
- if (!callback) {
- calls[ev] = {};
- } else if (node = calls[ev]) {
- while ((prev = node) && (node = node.next)) {
- if (node.callback !== callback) {
- continue;
- }
- prev.next = node.next;
- node.context = node.callback = null;
- break;
- }
- }
- }
- return this;
- };
-
- /**
- * trigger a given event
- * Parameters:
- * eventName - name of event
- * Returns;
- * object being triggered on.
- */
- Dataset.Events.trigger = function(eventName) {
- var node, calls, callback, args, ev, events = ['all', eventName];
- if (!(calls = this._callbacks)) {
- return this;
- }
- while (ev = events.pop()) {
- if (!(node = calls[ev])) {
- continue;
- }
- args = ev === 'all' ? arguments : Array.prototype.slice.call(arguments, 1);
- while (node = node.next) {
- if (callback = node.callback) {
- callback.apply(node.context || this, args);
- }
- }
- }
- return this;
- };
-
// Used to build event objects accross the application.
Dataset.Events._buildEvent = function(delta, dataset) {
return new Dataset.Event(delta, dataset);
};
+
}(this, _));
(function(global, _) {
@@ -1902,6 +1829,7 @@ Version 0.0.1.2
(function(global, _) {
+ var Miso = global.Miso || (global.Miso = {});
var Dataset = global.Miso.Dataset;
/**
@@ -1938,7 +1866,7 @@ Version 0.0.1.2
return this;
};
- _.extend(Dataset.Product.prototype, Dataset.Events, {
+ _.extend(Dataset.Product.prototype, Miso.Events, {
/**
* return the raw value of the product
@@ -1996,14 +1924,14 @@ Version 0.0.1.2
var delta = this._buildDelta(this.value, producer.call(_self));
this.value = delta.changed;
if (_self.syncable) {
- var event = this._buildEvent(delta, this);
+ var event = Dataset.Events._buildEvent(delta, this);
if (!_.isUndefined(delta.old) && !options.silent && delta.old !== delta.changed) {
- this.trigger("change", event);
+ this.publish("change", event);
}
}
}
});
- this.bind("change", prod._sync, prod);
+ this.subscribe("change", prod._sync, { context : prod });
return prod;
} else {
@@ -2740,7 +2668,7 @@ Version 0.0.1.2
var positionRegex = /([A-Z]+)(\d+)/,
columnPositions = {};
- _.each(data.feed.entry, function(cell, index) {
+ _.each(data.feed.entry, function(cell) {
var parts = positionRegex.exec(cell.title.$t),
column = parts[1],
@@ -3041,7 +2969,8 @@ Version 0.0.1.2
(function(global, _) {
- var Dataset = global.Miso.Dataset;
+ var Miso = global.Miso || (global.Miso = {});
+ var Dataset = Miso.Dataset;
/**
* A Miso.Derived dataset is a regular dataset that has been derived
@@ -3081,9 +3010,9 @@ Version 0.0.1.2
});
if (this.parent.syncable) {
- _.extend(this, Dataset.Events);
+ _.extend(this, Miso.Events);
this.syncable = true;
- this.parent.bind("change", this._sync, this);
+ this.parent.subscribe("change", this._sync, { context : this });
}
};
@@ -3092,11 +3021,11 @@ Version 0.0.1.2
// inherit all of dataset's methods.
_.extend(Dataset.Derived.prototype, {
- _sync : function(event) {
+ _sync : function() {
// recompute the function on an event.
// TODO: would be nice to be more clever about this at some point.
this.func.call(this.args);
- this.trigger("change");
+ this.publish("change");
}
});
@@ -3143,7 +3072,6 @@ Version 0.0.1.2
// apply with the arguments columns, size, method
var computeMovingAverage = function() {
- var win = [];
// normalize columns arg - if single string, to array it.
if (typeof columns === "string") {
@@ -3156,7 +3084,7 @@ Version 0.0.1.2
.data.slice(size-1, this.parent.length);
// copy the columns we are NOT combining minus the sliced size.
- this.eachColumn(function(columnName, column, i) {
+ this.eachColumn(function(columnName, column) {
if (columns.indexOf(columnName) === -1 && columnName !== "_oids") {
// copy data
column.data = this.parent.column(columnName).data.slice(size-1, this.parent.length);
@@ -3299,7 +3227,6 @@ Version 0.0.1.2
// a cache of values
var categoryPositions = {},
categoryCount = 0,
- byColumnPosition = this._columnPositionByName[byColumn],
originalByColumn = this.parent.column(byColumn);
// bin all values by their
@@ -3338,7 +3265,6 @@ Version 0.0.1.2
_.each(columns, function(columnToGroup) {
var column = this.column(columnToGroup),
- value = this.parent.column(columnToGroup).data[i],
binPosition = categoryPositions[category];
column.data[binPosition].push(this.parent.rowByPosition(i));
Oops, something went wrong.

0 comments on commit 9da4124

Please sign in to comment.