Permalink
Browse files

Merge branch 'josh' into weo

  • Loading branch information...
joshrtay committed Aug 28, 2012
2 parents 4afe1aa + d791380 commit a7a0e6206f9ab2d341a40c837f8b521d85305b96
View
@@ -790,8 +790,8 @@ Commands.push({
// to match what was sent, in order to pass IOS security check.
// Hopefully they will update to a more recent websocket standard
// soon
- var _write = socket.write;
- socket.write = function(data){
+ /*var _write = socket.write;
+ socket.write = function(data) {
socket.write = _write;
var sdata = data.toString();
@@ -807,7 +807,7 @@ Commands.push({
}
return _write.apply(this, arguments);
- };
+ };*/
// app.proxy.proxyWebSocketRequest(req, socket, head);
p.proxy.proxyWebSocketRequest(req, socket, head,
View
@@ -170,6 +170,7 @@ var log_to_clients = function (msg) {
var start_server = function (bundle_path, port, mongo_url,
on_exit_callback, on_listen_callback) {
+ console.log('start server');
// environment
var env = {};
for (var k in process.env)
@@ -353,7 +354,7 @@ _.extend(DependencyWatcher.prototype, {
self.watches[filepath] = function() { fs.unwatchFile(filepath); };
} else {
// fs.watchFile doesn't work for directories (as tested on ubuntu)
- var watch = fs.watch(filepath, {interval: 500}, // poll a lot!
+ var watch = fs.watch(filepath, {}, // poll a lot!
_.bind(self._scan, self, false, filepath));
self.watches[filepath] = function() { watch.close(); };
}
@@ -451,6 +452,7 @@ var start_update_checks = function () {
// can't continue. If you change this, remember to call
// watcher.destroy() as appropriate.
exports.run = function (app_dir, bundle_opts, port) {
+ console.log('run');
var outer_port = port || 3000;
var inner_port = outer_port + 1;
var mongo_port = outer_port + 2;
@@ -523,7 +525,9 @@ exports.run = function (app_dir, bundle_opts, port) {
bundle_opts.subapp = 'root';
errors.concat(bundler.bundle(app_dir, bundle_path, bundle_opts));*/
+ console.log('start bundle', +new Date());
errors = bundler.bundle(app_dir, bundle_path, bundle_opts);
+ console.log('end bundle', +new Date());
@@ -563,7 +567,9 @@ exports.run = function (app_dir, bundle_opts, port) {
return;
}
+
start_watching();
+ console.log('finished start watching')
Status.running = true;
server_handle = start_server(bundle_path, inner_port, mongo_url, function () {
// on server exit
@@ -579,7 +585,7 @@ exports.run = function (app_dir, bundle_opts, port) {
request_queue = [];
});
-
+ console.log('finished start server');
// launch test bundle and server if needed.
if (test_bundle_opts) {
var errors =
@@ -612,6 +618,7 @@ exports.run = function (app_dir, bundle_opts, port) {
mongo_port,
function () { // On Mongo startup complete
// don't print mongo startup is slow warning.
+ console.log('mongo complete');
if (mongo_startup_print_timer) {
clearTimeout(mongo_startup_print_timer);
mongo_startup_print_timer = null;
@@ -621,9 +628,11 @@ exports.run = function (app_dir, bundle_opts, port) {
process_startup_printer();
process_startup_printer = null;
}
+ console.log('restart server from mongo');
restart_server();
},
function (code, signal) { // On Mongo dead
+ console.log('mongo code');
console.log("Unexpected mongo exit code " + code + ". Restarting.");
// if mongo dies 3 times with less than 5 seconds between each,
@@ -643,9 +652,11 @@ exports.run = function (app_dir, bundle_opts, port) {
// Wait a sec to restart.
setTimeout(launch, 1000);
});
+
};
start_proxy(outer_port, inner_port, function () {
+ console.log('proxy');
process.stdout.write("[[[[[ " + files.pretty_path(app_dir) + " ]]]]]\n\n");
mongo_startup_print_timer = setTimeout(function () {
@@ -656,6 +667,7 @@ exports.run = function (app_dir, bundle_opts, port) {
};
start_update_checks();
+ console.log('finish start update check');
launch();
});
};
View
@@ -64,6 +64,7 @@ var runtime_config = function (app_html) {
};
var run = function () {
+ console.log('run');
var bundle_dir = path.join(__dirname, '..');
// check environment
@@ -90,7 +91,9 @@ var run = function () {
io = require('socket.io');
io = io.listen(app);
- io.set('log level', 1);
+ io.set('log level', 1);
+ io.set('transports', [
+ 'websocket']);
// read bundle config file
var info_raw =

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -14,9 +14,7 @@ if (! Session.get("z")) {
Session.set("z", 1);
}
-<<<<<<< HEAD:examples/landmark-demo/client/landmark-demo.js
-Template.redrawButtons.events = {
-=======
+
Template.preserveDemo.x =
Template.constantDemo.x =
Template.stateDemo.x =
@@ -33,12 +31,17 @@ function () {
return Session.get("z");
};
+<<<<<<< HEAD
+
+Template.page.events({
+=======
<<<<<<< HEAD
Template.page.events = {
>>>>>>> 87bebaa50dc16e9b2df4fb78237421b9b44e4a32:examples/other/template-demo/client/template-demo.js
=======
Template.page.events({
>>>>>>> 9005cf34a0efeedfb339bbb7fd6ef7de6cb37def
+>>>>>>> d6b9f4960f57f2e43e76bce760253958d48c289e
'click input.x': function () {
Session.set("x", Session.get("x") + 1);
},
@@ -74,6 +77,12 @@ Template.preserveDemo.spinAnim = function () {
return this.template.get('spinForward') ? 'spinForward' : 'spinBackward';
};
+<<<<<<< HEAD
+
+Template.preserveDemo.events({
+ 'change .spinforward' : function (event) {
+ Session.set('spinForward', event.currentTarget.checked);
+=======
<<<<<<< HEAD
Template.preserveDemo.events = {
'change .spinforward' : function (event,template) {
@@ -83,6 +92,7 @@ Template.preserveDemo.events({
'change .spinforward' : function (event) {
Session.set('spinForward', event.currentTarget.checked);
>>>>>>> 9005cf34a0efeedfb339bbb7fd6ef7de6cb37def
+>>>>>>> d6b9f4960f57f2e43e76bce760253958d48c289e
}
});
@@ -191,6 +201,10 @@ Template.d3Demo.right = function () {
return { group: "right" };
};
+<<<<<<< HEAD
+
+Template.circles.events({
+=======
<<<<<<< HEAD
Template.circles.events = {
<<<<<<< HEAD:examples/landmark-demo/client/landmark-demo.js
@@ -204,9 +218,9 @@ Template.circles.events = {
=======
Template.circles.events({
>>>>>>> 9005cf34a0efeedfb339bbb7fd6ef7de6cb37def
+>>>>>>> d6b9f4960f57f2e43e76bce760253958d48c289e
'mousedown circle': function (evt, template) {
Session.set("selectedCircle:" + this.group, evt.currentTarget.id);
->>>>>>> 87bebaa50dc16e9b2df4fb78237421b9b44e4a32:examples/other/template-demo/client/template-demo.js
},
'click .add': function () {
Circles.insert({x: Meteor.random(), y: Meteor.random(),
@@ -12,3 +12,4 @@ accounts-weibo
accounts-google
accounts-facebook
accounts-passwords
+streamio
@@ -241,7 +241,11 @@ Template.todo_item.events[ okcancel_events('#todo-input') ] =
Template.todo_item.events(okCancelEvents(
'#todo-input',
{
+<<<<<<< HEAD
+>>>>>>> 1ca5357b28fa2a433a9eeb45144747c6a5c449b5
+=======
>>>>>>> 9005cf34a0efeedfb339bbb7fd6ef7de6cb37def
+>>>>>>> d6b9f4960f57f2e43e76bce760253958d48c289e
ok: function (value) {
Todos.update(this._id, {$set: {text: value}});
Session.set('editing_itemname', null);
View
@@ -21,8 +21,11 @@ var ReactiveVar = function(initialValue) {
initialValue);
this._deps = {};
this._equals_deps = {};
+
};
+
+
ReactiveVar.prototype.get = function() {
var self = this;
@@ -48,6 +51,7 @@ ReactiveVar.prototype.set = function(newValue, notReactive) {
self._value = newValue;
if (notReactive) return;
+ console.log('invalidate');
for(var id in self._deps)
self._deps[id].invalidate();
@@ -98,6 +102,20 @@ var ReactiveDict = function(initialValues) {
for (key in initialValues)
this._vars[key] = ReactiveVar(initialValues[key]);
+ this._key_deps = {};
+}
+
+// make this reactive
+ReactiveDict.prototype.keys = function() {
+ var self = this;
+ var context = Meteor.deps.Context.current;
+ if (context && !(context.id in self._key_deps)) {
+ self._key_deps[context.id] = context;
+ context.on_invalidate(function() {
+ delete self._key_deps[context.id];
+ });
+ }
+ return _.keys(this._vars);
}
ReactiveDict.prototype.get = function(key) {
@@ -127,8 +145,13 @@ ReactiveDict.prototype.equals = function(key, value) {
}
ReactiveDict.prototype._ensureKey = function(key) {
- if (!(key in this._vars))
- this._vars[key] = ReactiveVar();
+ var self = this;
+ if (!(key in self._vars)) {
+ self._vars[key] = ReactiveVar();
+ for(var id in self._key_deps)
+ self._key_deps[id].invalidate();
+ }
+
}
ReactiveDict.prototype.all = function() {
@@ -152,6 +152,7 @@ Meteor._LivedataConnection = function (url, restart_on_update) {
if (restart_on_update) {
self.stream.on('update_available', function () {
+ console.log('update_available');
// Start trying to migrate to a new version. Until all packages
// signal that they're ready for a migration, the app will
// continue running normally.
@@ -203,6 +204,7 @@ _.extend(Meteor._LivedataConnection.prototype, {
subscribe: function (name /* .. [arguments] .. callback */) {
var self = this;
var id;
+ var complete = false;
var args = Array.prototype.slice.call(arguments, 1);
if (args.length && typeof args[args.length - 1] === "function")
@@ -228,6 +230,9 @@ _.extend(Meteor._LivedataConnection.prototype, {
self.subs.insert({_id: id, name: name, args: args, count: 1});
self.sub_ready_callbacks[id] = [];
+ self.sub_ready_callbacks[id].push(function() {
+ complete = true;
+ })
if (callback)
self.sub_ready_callbacks[id].push(callback);
@@ -238,7 +243,15 @@ _.extend(Meteor._LivedataConnection.prototype, {
if (!id) return; // must have an id (local from above).
// just update the database. observe takes care of the rest.
self.subs.update({_id: id}, {$inc: {count: -1}});
- }};
+ },
+ complete: function() {
+ return complete || existing && existing[0];
+ },
+ completed: function(cb) {
+ self.sub_ready_callbacks[id].push(cb);
+ }
+
+ };
if (Meteor._capture_subs)
Meteor._capture_subs.push(token);
@@ -27,7 +27,7 @@ Meteor._LocalCollectionDriver = new Meteor._LocalCollectionDriver;
//speed up reload and ensure that first render after reload
//has same state as the last render before reload
//XXX this is geting errors
-/*if (Meteor._reload) {
+if (Meteor._reload) {
Meteor._reload.on_migrate('Collections',function() {
var collections = {};
_.each(Meteor._LocalCollectionDriver.collections,function(collection,name) {
@@ -38,4 +38,4 @@ Meteor._LocalCollectionDriver = new Meteor._LocalCollectionDriver;
(function() {
Meteor._LocalCollectionDriver.migrationData = Meteor._reload.migration_data('Collections') || {};
})();
-}*/
+}
Oops, something went wrong.

0 comments on commit a7a0e62

Please sign in to comment.