Poco::OSP::JS

class JSExecutor

File Information

Library:
Package:
Header: Poco/OSP/JS/JSExecutor.h

Description

An extension of the Poco::JS::Core::JSExecutor for executing JavaScript code within an OSP environment.

Adds the following global JavaScript objects:

  • bundle (Poco::OSP::Bundle wrapper)
  • properties (bundle properties wrapper)
  • serviceRegistry (Poco::OSP::ServiceRegistry wrapper)
  • logger (bundle context logger wrapper)
  • HTTPRequest (HTTP request constructor)
  • DBSession (Database session constructor)

Inheritance

Direct Base Classes: Poco::JS::Core::JSExecutor

All Base Classes: Poco::JS::Core::JSExecutor, Poco::RefCountedObject, Poco::Runnable

Member Summary

Member Functions: bundle, context, formatErrorInfo, getDefaultMemoryLimit, getGlobalModuleRegistry, getGlobalModuleSearchPaths, handleError, handleMemoryWarning, handleOutOfMemory, setDefaultMemoryLimit, setGlobalModuleRegistry, setGlobalModuleSearchPaths, setupGlobalObject, setupGlobalObjectTemplate

Inherited Functions: addModuleRegistry, addModuleSearchPath, attachToCurrentThread, buildStackTrace, call, callInContext, cancelTerminate, cleanup, compile, current, duplicate, globalContext, handleError, handleMemoryWarning, handleOutOfMemory, importModule, include, includeScript, isRunning, isTerminating, isolate, referenceCount, release, reportError, require, resolveModule, run, runImpl, scriptCompleted, scriptContext, setWrapperProperty, setup, setupGlobalObject, setupGlobalObjectTemplate, sleep, stop, terminate, uri

Types Aliases

Ptr

using Ptr = Poco::AutoPtr < JSExecutor >;

Constructors

JSExecutor

JSExecutor(
    Poco::OSP::BundleContext::Ptr pContext,
    Poco::OSP::Bundle::Ptr pBundle,
    const std::string & source,
    const Poco::URI & sourceURI,
    const std::vector < std::string > & moduleSearchPaths,
    Poco::UInt64 memoryLimit
);

Creates the JSExecutor.

Destructor

~JSExecutor virtual

~JSExecutor();

Destroys the JSExecutor.

Member Functions

bundle inline

Poco::OSP::Bundle::Ptr bundle() const;

Returns the bundle containing the script.

context inline

Poco::OSP::BundleContext::Ptr context() const;

Returns the bundle context.

formatErrorInfo static

static std::string formatErrorInfo(
    const ErrorInfo & errorInfo
);

Formats the given error information to a string suitable for logging.

getDefaultMemoryLimit static

static Poco::UInt64 getDefaultMemoryLimit();

Returns the global default memory limit for scripts.

getGlobalModuleRegistry static inline

static Poco::JS::Core::ModuleRegistry::Ptr getGlobalModuleRegistry();

Returns the global module registry.

getGlobalModuleSearchPaths static inline

static const std::vector < std::string > getGlobalModuleSearchPaths();

Returns the global module search paths.

setDefaultMemoryLimit static

static void setDefaultMemoryLimit(
    Poco::UInt64 memoryLimit
);

Sets the global default memory limit for scripts.

setGlobalModuleRegistry static

static void setGlobalModuleRegistry(
    Poco::JS::Core::ModuleRegistry::Ptr pModuleRegistry
);

Sets the global module registry.

setGlobalModuleSearchPaths static

static void setGlobalModuleSearchPaths(
    const std::vector < std::string > & searchPaths
);

Sets the global module search paths.

handleError protected virtual

void handleError(
    const ErrorInfo & errorInfo
);

handleMemoryWarning protected virtual

void handleMemoryWarning(
    std::size_t currentHeapLimit,
    std::size_t initialHeapLimit
);

handleOutOfMemory protected virtual

void handleOutOfMemory(
    std::size_t currentHeapLimit,
    std::size_t initialHeapLimit
);

setupGlobalObject protected virtual

void setupGlobalObject(
    v8::Local < v8::Object > & global,
    v8::Isolate * pIsolate
);

setupGlobalObjectTemplate protected virtual

void setupGlobalObjectTemplate(
    v8::Local < v8::ObjectTemplate > & global,
    v8::Isolate * pIsolate
);

Securely control IoT edge devices from anywhere   Connect a Device