Changeset 15384 in webkit for trunk/JavaScriptCore/API/JSObjectRef.h
- Timestamp:
- Jul 12, 2006, 2:55:55 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/API/JSObjectRef.h
r15376 r15384 194 194 /*! 195 195 @typedef JSObjectCallAsConstructorCallback 196 @abstract The callback invoked when an object is used as a constructor in a 'new' statement.196 @abstract The callback invoked when an object is used as a constructor in a 'new' expression. 197 197 @param context The current execution context. 198 198 @param constructor A JSObject that is the constructor being called. … … 207 207 If your callback were invoked by the JavaScript expression 'new myConstructorFunction()', constructor would be set to myConstructorFunction. 208 208 209 If this callback is NULL, using your object as a constructor in a 'new' statementwill throw an exception.209 If this callback is NULL, using your object as a constructor in a 'new' expression will throw an exception. 210 210 */ 211 211 typedef JSObjectRef 212 212 (*JSObjectCallAsConstructorCallback) (JSContextRef context, JSObjectRef constructor, size_t argc, JSValueRef argv[], JSValueRef* exception); 213 214 /*! 215 @typedef JSObjectHasInstanceCallback 216 @abstract The callback invoked when an object is used in an 'instanceof' expression. 217 @param context The current execution context. 218 @param constructor The JSObject receiving the hasInstance request 219 @param possibleInstance The JSValue being tested to determine if it is an instance of constructor. 220 @param exception A pointer to a JSValueRef in which to return an exception, if any. 221 @result true if possibleInstance is an instance of constructor, otherwise false 222 223 @discussion If you named your function HasInstance, you would declare it like this: 224 225 bool HasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception); 226 227 If your callback were invoked by the JavaScript expression 'someValue instanceof myObject', constructor would be set to myObject and possibleInstance would be set to someValue.. 228 229 If this callback is NULL, using your object in an 'instanceof' will always return false. 230 231 Standard JavaScript practice calls for objects that implement the callAsConstructor callback to implement the hasInstance callback as well. 232 */ 233 typedef bool 234 (*JSObjectHasInstanceCallback) (JSContextRef context, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception); 213 235 214 236 /*! … … 241 263 @field getPropertyList The callback invoked when adding an object's properties to a property list. 242 264 @field callAsFunction The callback invoked when an object is called as a function. 243 @field callAsConstructor The callback invoked when an object is used as a constructor in a 'new' statement. 265 @field hasInstance The callback invoked when an object is used in an 'instanceof' expression. 266 @field callAsConstructor The callback invoked when an object is used as a constructor in a 'new' expression. 244 267 @field convertToType The callback invoked when converting an object to a particular JavaScript type. 245 268 */ … … 255 278 JSObjectCallAsFunctionCallback callAsFunction; 256 279 JSObjectCallAsConstructorCallback callAsConstructor; 280 JSObjectHasInstanceCallback hasInstance; 257 281 JSObjectConvertToTypeCallback convertToType; 258 282 } JSObjectCallbacks; … … 344 368 @abstract Convenience method for creating a JavaScript constructor with a given callback as its implementation. 345 369 @param context The execution context to use. 346 @param callAsConstructor The JSObjectCallAsConstructorCallback to invoke when the constructor is used in a 'new' statement.370 @param callAsConstructor The JSObjectCallAsConstructorCallback to invoke when the constructor is used in a 'new' expression. 347 371 @result A JSObject that is a constructor. The object's prototype will be the default object prototype. 348 372 */
Note:
See TracChangeset
for help on using the changeset viewer.