Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 64 lines (49 sloc) 1.778 kb
ee99867 August "Gus" Mueller oh geeze
authored
1 //
2 // JSTListener.m
3 // jstalk
4 //
5 // Created by August Mueller on 1/14/09.
6 // Copyright 2009 Flying Meat Inc. All rights reserved.
7 //
8
9 #import "JSTListener.h"
10
11 @interface JSTListener (Private)
12 - (void)setupListener;
13 @end
14
15
16 @implementation JSTListener
17
18 @synthesize rootObject=_rootObject;
19
c07386b August "Gus" Mueller Added a new method "include" which includes and evals the named file
authored
20 + (id)sharedListener {
ee99867 August "Gus" Mueller oh geeze
authored
21 static JSTListener *me = 0x00;
22 if (!me) {
23 me = [[JSTListener alloc] init];
24 }
25
26 return me;
27 }
28
c07386b August "Gus" Mueller Added a new method "include" which includes and evals the named file
authored
29 + (void)listen {
ee99867 August "Gus" Mueller oh geeze
authored
30 [[self sharedListener] setupListener];
31 }
32
c07386b August "Gus" Mueller Added a new method "include" which includes and evals the named file
authored
33 + (void)listenWithRootObject:(id)rootObject; {
2949a10 Jonathan 'Wolf' Rentzsch [NEW] +[JSTListener listenWithRootObject:]
rentzsch authored
34 ((JSTListener*)[self sharedListener]).rootObject = rootObject;
35 [self listen];
36 }
37
ee99867 August "Gus" Mueller oh geeze
authored
38
c07386b August "Gus" Mueller Added a new method "include" which includes and evals the named file
authored
39 - (void)setupListener {
ee99867 August "Gus" Mueller oh geeze
authored
40 NSString *myBundleId = [[NSBundle mainBundle] bundleIdentifier];
41 NSString *port = [NSString stringWithFormat:@"%@.JSTalk", myBundleId];
42
43 _conn = [[NSConnection alloc] init];
267c582 Jonathan 'Wolf' Rentzsch [FIX] Enable Independent Conversation Queueing by default. [poison setPi...
rentzsch authored
44 // Pick your poision:
45 // "Without Independent Conversation Queueing, your app will be re-entered during upon a 2nd remote DO call if you return to the run loop"
46 // http://www.mac-developer-network.com/shows/podcasts/lnc/lnc020/
47 // "Because independent conversation queueing causes remote messages to block where they normally do not, it can cause deadlock to occur between applications."
48 // http://developer.apple.com/documentation/Cocoa/Conceptual/DistrObjects/Tasks/configuring.html#//apple_ref/doc/uid/20000766
49 // We'll go with ICQ for now.
50 [_conn setIndependentConversationQueueing:YES];
ee99867 August "Gus" Mueller oh geeze
authored
51 [_conn setRootObject:_rootObject ? _rootObject : NSApp];
52
53 if ([_conn registerName:port]) {
40f1991 August "Gus" Mueller cleaned up some console messages
authored
54 //NSLog(@"JSTalk listening on port %@", port);
ee99867 August "Gus" Mueller oh geeze
authored
55 }
56 else {
40f1991 August "Gus" Mueller cleaned up some console messages
authored
57 NSLog(@"JSTalk could not listen on port %@", port);
ee99867 August "Gus" Mueller oh geeze
authored
58 [_conn release];
59 _conn = 0x00;
60 }
61 }
62
63 @end
Something went wrong with that request. Please try again.