How to manage callback methods?
How to manage callback methods?
- Subject: How to manage callback methods?
- From: DevReseune <email@hidden>
- Date: Fri, 8 Aug 2003 13:07:58 +0200
Hi,
Cocoa uses many callback methods to wait events as to load a resource.
I hadn't find an usefull way to manage those callbacks.
For example, if I want to load a web document with WebKit, and when the
document is loaded, to do another action, I use the loadRequest of my
mainFrame and I have to set the delegate to wait the good event. So, my
action code is in the load method and in the delegate method. I think
it's complicated.
void loadDocument {
// ask WebKit to load the document
}
void delegateMethodOfWebKit {
// do the second action
}
And now, if you add another action that use the same method in the
delegate, the callback is more complicated!
void loadDocumentA {
// ask WebKit to load the document
}
void loadDocumentB {
// ask WebKit to load the document
}
void delegateMethodOfWebKit {
if (A)
// do the second action for A
else if (B)
// do the second action for B
}
So, how to manage this situation? For example, how to do that:
void loadDocumentA {
// ask WebKit to load the document
// wait resource load
// do the second action for A
}
void loadDocumentB {
// ask WebKit to load the document
// wait resource load
// do the second action for B
}
How to group all my code in one method?
Thanks.
Fridiric
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.