TreeFrogFramework  1.18
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

Enumerator
Default 
Jsx 

Constructor & Destructor Documentation

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

Constructor.

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

Constructor.

Member Function Documentation

QString TJSLoader::absolutePath ( const QString &  moduleName,
const QDir &  dir,
AltJS  alt 
) const
protected
QString TJSLoader::compileJsx ( const QString &  jsx)
static
QStringList TJSLoader::defaultSearchPaths ( )
static
void TJSLoader::import ( const QString &  moduleName)
void TJSLoader::import ( const QString &  defaultMember,
const QString &  moduleName 
)
QJSValue TJSLoader::importTo ( TJSModule context,
bool  isMain 
) const
protected
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 );

TJSInstance TJSLoader::loadAsConstructor ( const QJSValue &  arg) const
TJSInstance TJSLoader::loadAsConstructor ( const QJSValueList &  args = QJSValueList()) const
void TJSLoader::replaceRequire ( TJSModule context,
QString &  content,
const QDir &  dir 
) const
protected
QString TJSLoader::search ( const QString &  moduleName,
AltJS  alt 
) const
protected
void TJSLoader::setDefaultSearchPaths ( const QStringList &  paths)
static
void TJSLoader::setSearchPaths ( const QStringList &  paths)

Friends And Related Function Documentation

friend class TJSModule
friend

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