40@implementation Entity (OOJavaScriptExtensions)
54- (jsval) oo_jsValueInContext:(JSContext *)context
56 JSClass *
class = NULL;
57 JSObject *prototype = NULL;
58 jsval result = JSVAL_NULL;
65 _jsSelf = JS_NewObject(context,
class, prototype, NULL);
68 if (!JS_SetPrivate(context, _jsSelf,
OOConsumeReference([
self weakRetain]))) _jsSelf = NULL;
75 selector:@selector(deleteJSSelf)
76 name:kOOJavaScriptEngineWillResetNotification
81 if (_jsSelf != NULL) result = OBJECT_TO_JSVAL(_jsSelf);
54- (jsval) oo_jsValueInContext:(JSContext *)context {
…}
88- (void) getJSClass:(JSClass **)outClass andPrototype:(JSObject **)outPrototype
88- (void) getJSClass:(JSClass **)outClass andPrototype:(JSObject **)outPrototype {
…}
101 JS_RemoveObjectRoot(context, &_jsSelf);
105 name:kOOJavaScriptEngineWillResetNotification
113@implementation ShipEntity (OOJavaScriptExtensions)
121- (void) getJSClass:(JSClass **)outClass andPrototype:(JSObject **)outPrototype
121- (void) getJSClass:(JSClass **)outClass andPrototype:(JSObject **)outPrototype {
…}
145 while ([me isSubEntity])
147 if (me == [me owner] || [me owner] ==
nil)
break;
150 while ([target isSubEntity])
152 if (target == [target owner] || [target owner] ==
nil)
break;
155 if (![me isKindOfClass:[
ShipEntity class]])
return;
id OOConsumeReference(id OO_NS_CONSUMED value)
OOINLINE JSClass * JSEntityClass(void)
OOINLINE JSObject * JSEntityPrototype(void)
JSObject * JSShipPrototype(void)
JSClass * JSShipClass(void)
OOINLINE JSContext * OOJSAcquireContext(void)
#define OOJSAddGCObjectRoot(context, root, name)
OOINLINE void OOJSRelinquishContext(JSContext *context)
BOOL isVisibleToScripts()
NSString * oo_jsClassName()
NSArray * subEntitiesForScript()
NSString * oo_jsClassName()
BOOL isVisibleToScripts()
void getJSClass:andPrototype:(JSClass **outClass,[andPrototype] JSObject **outPrototype)
OOJavaScriptEngine * sharedEngine()
void addTarget:(Entity *targetEntity)
void removeTarget:(Entity *targetEntity)
NSEnumerator * shipSubEntityEnumerator()