TreeFrogFramework  1.29
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
TJSLoader Class Reference

#include <tjsloader.h>

Public Types

enum  AltJS { Default = 0, Jsx }
 

Public Member Functions

 TJSLoader (const QString &moduleName, AltJS alt=Default)
 
 TJSLoader (const QString &defaultMember, const QString &moduleName, AltJS alt=Default)
 
TJSModuleload (bool reload=false)
 
void import (const QString &moduleName)
 
void import (const QString &defaultMember, const QString &moduleName)
 
TJSInstance loadAsConstructor (const QJSValue &arg) const
 
TJSInstance loadAsConstructor (const QJSValueList &args=QJSValueList()) const
 
void setSearchPaths (const QStringList &paths)
 

Static Public Member Functions

static void setDefaultSearchPaths (const QStringList &paths)
 
static QStringList defaultSearchPaths ()
 
static QString compileJsx (const QString &jsx)
 

Protected Member Functions

QJSValue importTo (TJSModule *context, bool isMain) const
 
QString search (const QString &moduleName, AltJS alt) const
 
QString absolutePath (const QString &moduleName, const QDir &dir, AltJS alt) const
 
void replaceRequire (TJSModule *context, QString &content, const QDir &dir) const
 

Friends

class TJSModule
 

Detailed Description

The TJSLoader class loads a JavaScript module at run-time.

Member Enumeration Documentation

◆ AltJS

Enumerator
Default 
Jsx 

Constructor & Destructor Documentation

◆ TJSLoader() [1/2]

TJSLoader::TJSLoader ( const QString &  moduleName,
AltJS  alt = Default 
)

Constructor.

◆ TJSLoader() [2/2]

TJSLoader::TJSLoader ( const QString &  defaultMember,
const QString &  moduleName,
AltJS  alt = Default 
)

Constructor.

Member Function Documentation

◆ absolutePath()

QString TJSLoader::absolutePath ( const QString &  moduleName,
const QDir &  dir,
AltJS  alt 
) const
protected

◆ compileJsx()

QString TJSLoader::compileJsx ( const QString &  jsx)
static

◆ defaultSearchPaths()

QStringList TJSLoader::defaultSearchPaths ( )
static

◆ import() [1/2]

void TJSLoader::import ( const QString &  defaultMember,
const QString &  moduleName 
)

◆ import() [2/2]

void TJSLoader::import ( const QString &  moduleName)

◆ importTo()

QJSValue TJSLoader::importTo ( TJSModule context,
bool  isMain 
) const
protected

◆ load()

TJSModule * TJSLoader::load ( bool  reload = false)

Loads the JavaScript module and returns the JavaScript context if successful; otherwise returns null pointer.

i.e. var defaultMember = require( moduleName );

◆ loadAsConstructor() [1/2]

TJSInstance TJSLoader::loadAsConstructor ( const QJSValue &  arg) const

◆ loadAsConstructor() [2/2]

TJSInstance TJSLoader::loadAsConstructor ( const QJSValueList &  args = QJSValueList()) const

◆ replaceRequire()

void TJSLoader::replaceRequire ( TJSModule context,
QString &  content,
const QDir &  dir 
) const
protected

◆ search()

QString TJSLoader::search ( const QString &  moduleName,
AltJS  alt 
) const
protected

◆ setDefaultSearchPaths()

void TJSLoader::setDefaultSearchPaths ( const QStringList &  paths)
static

◆ setSearchPaths()

void TJSLoader::setSearchPaths ( const QStringList &  paths)

Friends And Related Function Documentation

◆ TJSModule

friend class TJSModule
friend

The documentation for this class was generated from the following files: