Poco::JS::Core

class Module

File Information

Library: JS/Core
Package: Execution
Header: Poco/JS/Core/Module.h

Description

A JavaScript native module, implemented in C++.

Inheritance

Direct Base Classes: Poco::RefCountedObject

All Base Classes: Poco::RefCountedObject

Member Summary

Member Functions: exportIt

Inherited Functions: duplicate, referenceCount, release

Types Aliases

Ptr

using Ptr = Poco::AutoPtr < Module >;

Constructors

Module

Module();

Creates the Module.

Destructor

~Module virtual

virtual ~Module();

Destroys the Module.

Member Functions

exportIt virtual

virtual v8::Local < v8::Object > exportIt(
    v8::Isolate * pIsolate
) = 0;

Creates a the JavaScript Object or Function this module exports.

A typical implementation uses a wrapper class to create a constructor function, and then exports that function:

v8::EscapableHandleScope handleScope(pIsolate);
SomeWrapper someWrapper;
v8::Local<v8::Function> ctor = someWrapper.constructor(pIsolate);
return handleScope.escape(ctor);
Securely control IoT edge devices from anywhere   Connect a Device