[Twisted-web] 2 small patches for livepage-completion-notification-3
sifu-twisted at 0xx0.net
sifu-twisted at 0xx0.net
Thu Jun 16 03:51:45 MDT 2005
hi!
i have two small patches for the livepage-completion-notification-3
branch.
the first one adds the possibility to set callbacks, which are called in
case the livepage connection dies.
it's basically what fzZzy told my on #twisted.web today.
"<fzZzy> then, on line 35, do..." ;)
the second patch adds a "prepend" helper method to ClientHandle.
bye bye - sifu
---
http://sifu.info
-------------- next part --------------
Index: liveglue.js
===================================================================
--- liveglue.js (revision 1557)
+++ liveglue.js (working copy)
@@ -32,6 +32,10 @@
connect(outputNum + 1)
}
} else {
+ for (var i in disconnectListeners) {
+ disconnectListeners[i]()
+ disconnectListeners = []
+ }
last_request = null
}
}
@@ -108,7 +112,22 @@
}
}
+var disconnectListeners = []
+function addDisconnectListener(callback) {
+ disconnectListeners.push(callback)
+ return callback
+}
+
+function delDisconnectListener(theListener) {
+ for (var i in disconnectListeners) {
+ if (disconnectListeners[i] == theListener){
+ disconnectListeners.splice(i, 1)
+ break
+ }
+ }
+}
+
function nevow_clientToServerEvent(theTarget, evalAfterDone) {
if (theTarget != 'close' && liveevil_unload) {
// Server had previously closed the output; let's open it again.
-------------- next part --------------
Index: livepage.py
===================================================================
--- livepage.py (revision 1557)
+++ livepage.py (working copy)
@@ -455,6 +455,9 @@
def set(self, where, what):
self.send(js.nevow_setNode(where, what))
+ def prepend(self, where, what):
+ self.send(js.nevow_prependNode(where, what))
+
def append(self, where, what):
self.send(js.nevow_appendNode(where, what))
More information about the Twisted-web
mailing list