Poco::OSP::JS

class TimedJSExecutor

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

Description

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

Will stop the executing JavaScript when the containing bundle is stopped.

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::TimedJSExecutor

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

Member Summary

Member Functions: bundle, context, handleError, onBundleStopped, setupGlobalObject, setupGlobalObjectTemplate

Inherited Functions: addModuleRegistry, addModuleSearchPath, attachToCurrentThread, call, callInContext, cancelTerminate, cancelTimer, cleanup, compile, current, duplicate, globalContext, handleError, importModule, include, includeScript, isRunning, isTerminating, isolate, referenceCount, release, reportError, require, resolveModule, run, runImpl, schedule, scriptCompleted, scriptContext, setImmediate, setInterval, setTimeout, setup, setupGlobalObject, setupGlobalObjectTemplate, stop, terminate, timer, uri

Types Aliases

Ptr

using Ptr = Poco::AutoPtr < TimedJSExecutor >;

Constructors

TimedJSExecutor

TimedJSExecutor(
    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 TimedJSExecutor.

Destructor

~TimedJSExecutor virtual

~TimedJSExecutor();

Destroys the TimedJSExecutor.

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.

handleError protected virtual

void handleError(
    const ErrorInfo & errorInfo
);

onBundleStopped protected

void onBundleStopped(
    const void * pSender,
    Poco::OSP::BundleEvent & ev
);

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