Exemplo n.º 1
0
void Query::Initialize(Handle<Object> target) {
    HandleScope scope;
    constructor = Persistent<FunctionTemplate>::New(FunctionTemplate::New(Query::New));
    constructor->InstanceTemplate()->SetInternalFieldCount(1);
    constructor->SetClassName(String::NewSymbol("Query"));
    target->Set(String::NewSymbol("Query"),constructor->GetFunction());
}
Exemplo n.º 2
0
// initialize a JS wrapper around this object
void NodeFSEvents::Initialize(Handle<Object> target)
{
    HandleScope scope;
    emit_sym = NODE_PSYMBOL("emit");
    change_sym = NODE_PSYMBOL("fsevent");
    Local<FunctionTemplate> t = FunctionTemplate::New(NodeFSEvents::New);
    constructor_template = Persistent<FunctionTemplate>::New(t);
    constructor_template->InstanceTemplate()->SetInternalFieldCount(1);
    constructor_template->SetClassName(String::NewSymbol("FSEvents"));
    Local<Function> constructor = constructor_template->GetFunction();

    constructor->Set(String::New("kFSEventStreamEventFlagNone"), Integer::New(0x00000000));
    constructor->Set(String::New("kFSEventStreamEventFlagMustScanSubDirs"), Integer::New(0x00000001));
    constructor->Set(String::New("kFSEventStreamEventFlagUserDropped"), Integer::New(0x00000002));
    constructor->Set(String::New("kFSEventStreamEventFlagKernelDropped"), Integer::New(0x00000004));
    constructor->Set(String::New("kFSEventStreamEventFlagEventIdsWrapped"), Integer::New(0x00000008));
    constructor->Set(String::New("kFSEventStreamEventFlagHistoryDone"), Integer::New(0x00000010));
    constructor->Set(String::New("kFSEventStreamEventFlagRootChanged"), Integer::New(0x00000020));
    constructor->Set(String::New("kFSEventStreamEventFlagMount"), Integer::New(0x00000040));
    constructor->Set(String::New("kFSEventStreamEventFlagUnmount"), Integer::New(0x00000080));
    constructor->Set(String::New("kFSEventStreamEventFlagItemCreated"), Integer::New(0x00000100));
    constructor->Set(String::New("kFSEventStreamEventFlagItemRemoved"), Integer::New(0x00000200));
    constructor->Set(String::New("kFSEventStreamEventFlagItemInodeMetaMod"), Integer::New(0x00000400));
    constructor->Set(String::New("kFSEventStreamEventFlagItemRenamed"), Integer::New(0x00000800));
    constructor->Set(String::New("kFSEventStreamEventFlagItemModified"), Integer::New(0x00001000));
    constructor->Set(String::New("kFSEventStreamEventFlagItemFinderInfoMod"), Integer::New(0x00002000));
    constructor->Set(String::New("kFSEventStreamEventFlagItemChangeOwner"), Integer::New(0x00004000));
    constructor->Set(String::New("kFSEventStreamEventFlagItemXattrMod"), Integer::New(0x00008000));
    constructor->Set(String::New("kFSEventStreamEventFlagItemIsFile"), Integer::New(0x00010000));
    constructor->Set(String::New("kFSEventStreamEventFlagItemIsDir"), Integer::New(0x00020000));
    constructor->Set(String::New("kFSEventStreamEventFlagItemIsSymlink"), Integer::New(0x00040000));

    target->Set(String::NewSymbol("FSEvents"), constructor);
}
Exemplo n.º 3
0
void Engine::Initialize(Handle<Object> target) {
    HandleScope scope;
    constructor = Persistent<FunctionTemplate>::New(FunctionTemplate::New(Engine::New));
    constructor->InstanceTemplate()->SetInternalFieldCount(1);
    constructor->SetClassName(String::NewSymbol("Engine"));
    NODE_SET_PROTOTYPE_METHOD(constructor, "run", run);
    NODE_SET_PROTOTYPE_METHOD(constructor, "runSync", run);
    target->Set(String::NewSymbol("Engine"),constructor->GetFunction());
}
Exemplo n.º 4
0
  static void Init(Handle<Object> target)
  {
    s_ct = Persistent<FunctionTemplate>::New(FunctionTemplate::New(New));
    s_ct->InstanceTemplate()->SetInternalFieldCount(1);
    s_ct->SetClassName(String::NewSymbol("HelloWorld"));

    NODE_SET_PROTOTYPE_METHOD(s_ct, "hi", Hello);

    target->Set(String::NewSymbol("HelloWorld"),
                s_ct->GetFunction());
  }
Exemplo n.º 5
0
        static void Init(Handle<Object> target)
        {
            s_ct = Persistent<FunctionTemplate>::New(FunctionTemplate::New(New));
            s_ct->InstanceTemplate()->SetInternalFieldCount(1);
            s_ct->SetClassName(String::NewSymbol("Scws"));

            // bind methods
            NODE_SET_PROTOTYPE_METHOD(s_ct, "segment", segment);


            // expose class as Scws
            target->Set(String::NewSymbol("Scws"), s_ct->GetFunction());
        }
Exemplo n.º 6
0
    static void Init(Handle<Object> target) {
        HandleScope scope;

        Local<FunctionTemplate> t = FunctionTemplate::New(New);

        s_ct = Persistent<FunctionTemplate>::New(t);
        s_ct->InstanceTemplate()->SetInternalFieldCount(1);
        s_ct->SetClassName(String::NewSymbol("Lucene"));

        NODE_SET_PROTOTYPE_METHOD(s_ct, "addDocument", AddDocumentAsync);
        NODE_SET_PROTOTYPE_METHOD(s_ct, "search", SearchAsync);

        target->Set(String::NewSymbol("Lucene"), s_ct->GetFunction());
    }
Exemplo n.º 7
0
void NodeRTree::Initialize(Handle<Object> target) {
    HandleScope scope;

    Local<FunctionTemplate> t = FunctionTemplate::New(New);

    s_ct = Persistent<FunctionTemplate>::New(t);
    s_ct->InstanceTemplate()->SetInternalFieldCount(1);
    s_ct->SetClassName(String::NewSymbol("RTree"));

    NODE_SET_PROTOTYPE_METHOD(s_ct, "insertData", InsertData);

    target->Set(String::NewSymbol("RTree"), s_ct->GetFunction());

}
Exemplo n.º 8
0
	static void Init(Handle<Object> target){
		HandleScope scope;

		Local<FunctionTemplate> t = FunctionTemplate::New(New);

		s_ct = Persistent<FunctionTemplate>::New(t);
		s_ct->InstanceTemplate()->SetInternalFieldCount(1);
		s_ct->SetClassName(String::NewSymbol("Connection"));

		NODE_SET_PROTOTYPE_METHOD(s_ct, "Connect", Connect);
		NODE_SET_PROTOTYPE_METHOD(s_ct, "Subscribe", Subscribe);
		NODE_SET_PROTOTYPE_METHOD(s_ct, "Publish", Publish);

		target->Set(String::NewSymbol("Connection"), s_ct->GetFunction());
	}
Exemplo n.º 9
0
Arquivo: fft.cpp Projeto: EQ4/node-dsp
void NodeFFT::Initialize (Handle<Object> target) {
	HandleScope scope;

	Local<FunctionTemplate> t = FunctionTemplate::New(New);
	fft_constructor_template = Persistent<FunctionTemplate>::New(t);
	fft_constructor_template->InstanceTemplate()->SetInternalFieldCount(1);
	fft_constructor_template->SetClassName(String::NewSymbol("FFT"));

	NODE_SET_PROTOTYPE_METHOD(fft_constructor_template, "forward", Forward);
	NODE_SET_PROTOTYPE_METHOD(fft_constructor_template, "forwardCplx", ForwardCplx);
	NODE_SET_PROTOTYPE_METHOD(fft_constructor_template, "inverse", Forward);
	NODE_SET_PROTOTYPE_METHOD(fft_constructor_template, "inverseCplx", InverseCplx);

	target->Set(String::NewSymbol("FFT"), fft_constructor_template->GetFunction());
}
Exemplo n.º 10
0
    static void Init(Handle<Object> target) {
        PRINTF("Entering Init\n");
        PRINTF("EV_DEFAULT_ = %s\n", TEST_EV_DEFAULT_NAME);
        HandleScope scope;
        
        Local<FunctionTemplate> t = FunctionTemplate::New(New);
        ct = Persistent<FunctionTemplate>::New(t);
        ct->InstanceTemplate()->SetInternalFieldCount(1);
        ct->SetClassName(String::NewSymbol("Pollpri"));
        target->Set(String::NewSymbol("Pollpri"), ct->GetFunction());
        
        target->Set(String::NewSymbol("delay"), 
            FunctionTemplate::New(delay)->GetFunction());

        PRINTF("Leaving Init\n");
    }
Exemplo n.º 11
0
	void QuickWindowWrap::Initialize(Handle<Object> target)
	{
		HandleScope scope;

		Local<String> name = String::NewSymbol("QuickWindow");

		/* Constructor template */
		Persistent<FunctionTemplate> tpl = Persistent<FunctionTemplate>::New(FunctionTemplate::New(QuickWindowWrap::New));
		tpl->InstanceTemplate()->SetInternalFieldCount(1);  
		tpl->SetClassName(name);

		/* Prototype */
		NODE_SET_PROTOTYPE_METHOD(tpl, "show", QuickWindowWrap::show);
		NODE_SET_PROTOTYPE_METHOD(tpl, "toObject", QuickWindowWrap::toObject);

		constructor = Persistent<Function>::New(tpl->GetFunction());

		target->Set(name, constructor);
	}
Exemplo n.º 12
0
    static void NODE_EXTERN Init(Handle<Object> target)
    {
        HandleScope scope;

        // set the constructor function
        Local<FunctionTemplate> t = FunctionTemplate::New(New);

        // set the node.js/v8 class name
        s_ct = Persistent<FunctionTemplate>::New(t);
        s_ct->InstanceTemplate()->SetInternalFieldCount(1);
        s_ct->SetClassName(String::NewSymbol("SharpObject"));

        // registers a class member functions 
        NODE_SET_PROTOTYPE_METHOD(s_ct, "async", Async);
        NODE_SET_PROTOTYPE_METHOD(s_ct, "async2", Async2);
        NODE_SET_PROTOTYPE_METHOD(s_ct, "getSharpValue", GetSharpValue);

        target->Set(String::NewSymbol("SharpObject"),
            s_ct->GetFunction());
    }
Exemplo n.º 13
0
    static void NODE_EXTERN Init(Handle<Object> target)
    {
        HandleScope scope;

        // set the constructor function
        Local<FunctionTemplate> t = FunctionTemplate::New(New);

        // set the node.js/v8 class name
        s_ct = Persistent<FunctionTemplate>::New(t);
        s_ct->InstanceTemplate()->SetInternalFieldCount(1);
        s_ct->SetClassName(String::NewSymbol("tsqlftw"));

        // registers a class member functions 
        NODE_SET_PROTOTYPE_METHOD(s_ct, "connect", connect);
		NODE_SET_PROTOTYPE_METHOD(s_ct, "query", query);
		NODE_SET_PROTOTYPE_METHOD(s_ct, "close", close);

        target->Set(String::NewSymbol("tsqlftw"),
            s_ct->GetFunction());
    }