Browse Source

Added ImageData::constructor

v1.x
Tj Holowaychuk 14 years ago
parent
commit
db56ec26e7
  1. 10
      src/ImageData.cc
  2. 1
      src/ImageData.h

10
src/ImageData.cc

@ -14,15 +14,15 @@
void
ImageData::Initialize(Handle<Object> target) {
HandleScope scope;
Local<FunctionTemplate> t = FunctionTemplate::New(ImageData::New);
t->InstanceTemplate()->SetInternalFieldCount(1);
t->SetClassName(String::NewSymbol("ImageData"));
constructor = Persistent<FunctionTemplate>::New(FunctionTemplate::New(ImageData::New));
constructor->InstanceTemplate()->SetInternalFieldCount(1);
constructor->SetClassName(String::NewSymbol("ImageData"));
// Prototype
Local<ObjectTemplate> proto = t->PrototypeTemplate();
Local<ObjectTemplate> proto = constructor->PrototypeTemplate();
proto->SetAccessor(String::NewSymbol("width"), GetWidth);
proto->SetAccessor(String::NewSymbol("height"), GetHeight);
target->Set(String::NewSymbol("ImageData"), t->GetFunction());
target->Set(String::NewSymbol("ImageData"), constructor->GetFunction());
}
/*

1
src/ImageData.h

@ -14,6 +14,7 @@
class ImageData: public node::ObjectWrap {
public:
static Persistent<FunctionTemplate> constructor;
static void Initialize(Handle<Object> target);
static Handle<Value> New(const Arguments &args);
static Handle<Value> GetWidth(Local<String> prop, const AccessorInfo &info);

Loading…
Cancel
Save