• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How to manage callback methods?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Re: Loading 2 classes with same name
  • Next by Date: Re: String Encoding Detection (Revisited)
  • Previous by thread: [OT] New employer wanted
  • Next by thread: Re: Ridiculously Enormous PDFs and Printing
  • Index(es):
    • Date
    • Thread