Oolite 1.91.0.7645-241119-222d325
Loading...
Searching...
No Matches
OOJSTimer(Private) Category Reference

Instance Methods

(id) - initWithDelay:interval:context:function:this:
 

Detailed Description

Definition at line 39 of file OOJSTimer.m.

Method Documentation

◆ initWithDelay:interval:context:function:this:

- (id) initWithDelay: (OOTimeAbsolute) delay
interval: (OOTimeDelta) interval
context: (JSContext *) context
function: (jsval) function
this: (JSObject *) jsThis 

Extends class OOJSTimer.

Definition at line 444 of file OOJSTimer.m.

52 :(OOTimeAbsolute)delay
53 interval:(OOTimeDelta)interval
54 context:(JSContext *)context
55 function:(jsval)function
56 this:(JSObject *)jsThis
57{
58 self = [super initWithNextTime:[UNIVERSE getTime] + delay interval:interval];
59 if (self != nil)
60 {
61 NSAssert(OOJSValueIsFunction(context, function), @"Attempt to init OOJSTimer with a function that isn't.");
62
63 _jsThis = jsThis;
64 OOJSAddGCObjectRoot(context, &_jsThis, "OOJSTimer this");
65
66 _function = function;
67 OOJSAddGCValueRoot(context, &_function, "OOJSTimer function");
68
69 _jsSelf = JS_NewObject(context, &sTimerClass, sTimerPrototype, NULL);
70 if (_jsSelf != NULL)
71 {
72 if (!JS_SetPrivate(context, _jsSelf, [self retain])) _jsSelf = NULL;
73 }
74 if (_jsSelf == NULL)
75 {
76 [self release];
77 return nil;
78 }
79
81
82 [[NSNotificationCenter defaultCenter] addObserver:self
83 selector:@selector(deleteJSPointers)
84 name:kOOJavaScriptEngineWillResetNotification
86 }
87
88 return self;
89}
static JSObject * sTimerPrototype
Definition OOJSTimer.m:35
static JSClass sTimerClass
Definition OOJSTimer.m:36
OOINLINE BOOL OOJSValueIsFunction(JSContext *context, jsval value)
#define OOJSAddGCObjectRoot(context, root, name)
#define OOJSAddGCValueRoot(context, root, name)
return nil
double OOTimeDelta
Definition OOTypes.h:224
double OOTimeAbsolute
Definition OOTypes.h:223
OOJSScript * currentlyRunningScript()
Definition OOJSScript.m:339
OOJavaScriptEngine * sharedEngine()

The documentation for this category was generated from the following file: