Index: include/v8.h |
diff --git a/include/v8.h b/include/v8.h |
index d4e76f5c76f54607809dcec3b67c4915289110fe..b08607bee6a531a512e02dd5153603c9b9fdac32 100644 |
--- a/include/v8.h |
+++ b/include/v8.h |
@@ -3876,6 +3876,31 @@ struct NamedPropertyHandlerConfiguration { |
}; |
+struct IndexedPropertyHandlerConfiguration { |
+ IndexedPropertyHandlerConfiguration( |
+ /** Note: getter is required **/ |
+ IndexedPropertyGetterCallback getter = 0, |
+ IndexedPropertySetterCallback setter = 0, |
+ IndexedPropertyQueryCallback query = 0, |
+ IndexedPropertyDeleterCallback deleter = 0, |
+ IndexedPropertyEnumeratorCallback enumerator = 0, |
+ Handle<Value> data = Handle<Value>()) |
+ : getter(getter), |
+ setter(setter), |
+ query(query), |
+ deleter(deleter), |
+ enumerator(enumerator), |
+ data(data) {} |
+ |
+ IndexedPropertyGetterCallback getter; |
+ IndexedPropertySetterCallback setter; |
+ IndexedPropertyQueryCallback query; |
+ IndexedPropertyDeleterCallback deleter; |
+ IndexedPropertyEnumeratorCallback enumerator; |
+ Handle<Value> data; |
+}; |
+ |
+ |
/** |
* An ObjectTemplate is used to create objects at runtime. |
* |
@@ -3958,6 +3983,7 @@ class V8_EXPORT ObjectTemplate : public Template { |
* \param data A piece of data that will be passed to the callbacks |
* whenever they are invoked. |
*/ |
+ // TODO(dcarney): deprecate |
void SetNamedPropertyHandler( |
NamedPropertyGetterCallback getter, |
NamedPropertySetterCallback setter = 0, |
@@ -3983,14 +4009,18 @@ class V8_EXPORT ObjectTemplate : public Template { |
* \param data A piece of data that will be passed to the callbacks |
* whenever they are invoked. |
*/ |
+ void SetHandler(const IndexedPropertyHandlerConfiguration& configuration); |
+ // TODO(dcarney): deprecate |
void SetIndexedPropertyHandler( |
IndexedPropertyGetterCallback getter, |
IndexedPropertySetterCallback setter = 0, |
IndexedPropertyQueryCallback query = 0, |
IndexedPropertyDeleterCallback deleter = 0, |
IndexedPropertyEnumeratorCallback enumerator = 0, |
- Handle<Value> data = Handle<Value>()); |
- |
+ Handle<Value> data = Handle<Value>()) { |
+ SetHandler(IndexedPropertyHandlerConfiguration(getter, setter, query, |
+ deleter, enumerator, data)); |
+ } |
/** |
* Sets the callback to be used when calling instances created from |
* this template as a function. If no callback is set, instances |