Skip to content

Commit

Permalink
0.1.5: Fixed subscription ready property
Browse files Browse the repository at this point in the history
Fixes #11
  • Loading branch information
numtel committed Apr 7, 2015
1 parent 8d7ce84 commit 63efa9c
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 42 deletions.
74 changes: 36 additions & 38 deletions .versions
Original file line number Diff line number Diff line change
@@ -1,38 +1,36 @@
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
local-test:numtel:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
numtel:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
sharlon:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
grigio:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]_2
[email protected]
local-test:numtel:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
numtel:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
9 changes: 7 additions & 2 deletions lib/LiveMysql.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
// numtel:mysql
// MIT License, [email protected]
// lib/LiveMysql.js
var Future = Npm.require('fibers/future');

LiveMysql = Npm.require('mysql-live-select');

// Convert the LiveMysqlSelect object into a cursor
LiveMysql.LiveMysqlSelect.prototype._publishCursor = function(sub) {
var self = this;
var fut = new Future;
var initLength;

sub.onStop(function(){
Expand All @@ -23,7 +26,7 @@ LiveMysql.LiveMysqlSelect.prototype._publishCursor = function(sub) {
self.on('update', function(rows){
if(sub._ready === false){
initLength = rows.length;
if(initLength === 0) sub.ready();
if(initLength === 0) fut['return']();
}
});

Expand All @@ -43,9 +46,11 @@ LiveMysql.LiveMysqlSelect.prototype._publishCursor = function(sub) {
selectHandler('added', 0, 1, function(){
if(sub._ready === false &&
self.data.length === initLength - 1){
sub.ready();
fut['return']();
}
});
selectHandler('changed', 1, 2);
selectHandler('removed', null, 1);

return fut.wait()
}
4 changes: 2 additions & 2 deletions package.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package.describe({
name: 'numtel:mysql',
summary: 'MySQL support with Reactive Select Subscriptions',
version: '0.1.4',
version: '0.1.5',
git: 'https://github.com/numtel/meteor-mysql.git'
});

Expand Down Expand Up @@ -32,7 +32,7 @@ Package.onTest(function(api) {
'underscore',
'autopublish',
'insecure',
'sharlon:6to5',
'grigio:[email protected]',
'numtel:mysql'
]);
api.use('test-helpers'); // Did not work concatenated above
Expand Down

0 comments on commit 63efa9c

Please sign in to comment.