-
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Enabled declarative function interception * Enabled custom object converter in function callback * Added ``allowEval`` to ``JavetEngineConfig`` * Refactored built-in module API for Node.js mode
- Loading branch information
Showing
86 changed files
with
3,626 additions
and
2,593 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
// Microsoft Visual C++ generated resource script. | ||
// | ||
#include "resource.h" | ||
|
||
#define APSTUDIO_READONLY_SYMBOLS | ||
///////////////////////////////////////////////////////////////////////////// | ||
// | ||
// Generated from the TEXTINCLUDE 2 resource. | ||
// | ||
#include "winres.h" | ||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
#undef APSTUDIO_READONLY_SYMBOLS | ||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
// Chinese (Simplified, PRC) resources | ||
|
||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS) | ||
LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED | ||
#pragma code_page(936) | ||
|
||
#ifdef APSTUDIO_INVOKED | ||
///////////////////////////////////////////////////////////////////////////// | ||
// | ||
// TEXTINCLUDE | ||
// | ||
|
||
1 TEXTINCLUDE | ||
BEGIN | ||
"resource.h\0" | ||
END | ||
|
||
2 TEXTINCLUDE | ||
BEGIN | ||
"#include ""winres.h""\r\n" | ||
"\0" | ||
END | ||
|
||
3 TEXTINCLUDE | ||
BEGIN | ||
"\r\n" | ||
"\0" | ||
END | ||
|
||
#endif // APSTUDIO_INVOKED | ||
|
||
#endif // Chinese (Simplified, PRC) resources | ||
///////////////////////////////////////////////////////////////////////////// | ||
|
||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
// English (United States) resources | ||
|
||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) | ||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US | ||
#pragma code_page(1252) | ||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
// | ||
// Version | ||
// | ||
|
||
VS_VERSION_INFO VERSIONINFO | ||
FILEVERSION 0,8,1,0 | ||
PRODUCTVERSION 0,8,1,0 | ||
FILEFLAGSMASK 0x3fL | ||
#ifdef _DEBUG | ||
FILEFLAGS 0x1L | ||
#else | ||
FILEFLAGS 0x0L | ||
#endif | ||
FILEOS 0x40004L | ||
FILETYPE 0x2L | ||
FILESUBTYPE 0x0L | ||
BEGIN | ||
BLOCK "StringFileInfo" | ||
BEGIN | ||
BLOCK "000904b0" | ||
BEGIN | ||
VALUE "CompanyName", "caoccao.com" | ||
VALUE "FileDescription", "caoccao.com" | ||
VALUE "FileVersion", "0.8.1.0" | ||
VALUE "InternalName", "libjavet-node-windows-x86_64.v.0.8.1.dll" | ||
VALUE "LegalCopyright", "Copyright (C) 2021" | ||
VALUE "OriginalFilename", "libjavet-node-windows-x86_64.v.0.8.1.dll" | ||
VALUE "ProductName", "Javet Windows" | ||
VALUE "ProductVersion", "0.8.1.0" | ||
END | ||
END | ||
BLOCK "VarFileInfo" | ||
BEGIN | ||
VALUE "Translation", 0x9, 1200 | ||
END | ||
END | ||
|
||
#endif // English (United States) resources | ||
///////////////////////////////////////////////////////////////////////////// | ||
|
||
|
||
|
||
#ifndef APSTUDIO_INVOKED | ||
///////////////////////////////////////////////////////////////////////////// | ||
// | ||
// Generated from the TEXTINCLUDE 3 resource. | ||
// | ||
|
||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
#endif // not APSTUDIO_INVOKED | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
====================== | ||
How to Think in Javet? | ||
====================== | ||
|
||
There are folks migrating projects from other libraries (e.g. J2V8) to Javet. Some experienced certain challenges which from Javet perspective required **Thinking in Javet**. So, how? | ||
|
||
``V8Runtime`` and ``V8ValueGlobalObject`` | ||
========================================= | ||
|
||
In Javet, ``V8Runtime`` and ``V8ValueGlobalObject`` are separate concepts. | ||
|
||
``V8Runtime`` | ||
------------- | ||
|
||
``V8Runtime`` is only a representative of the V8 isolate and V8 context. It has nothing to do with ``globalThis`` or ``window``. However, in few other libraries these concepts are mixed up. | ||
|
||
``V8ValueGlobalObject`` | ||
----------------------- | ||
|
||
As ``V8Runtime`` no longer represents ``globalThis`` or ``window``, ``V8ValueGlobalObject`` from ``V8Runtime.getGlobalObject()`` is the one. | ||
|
||
If you want to access global objects or call top level functions, ``globalObject.get('...')`` and ``globalObject.invoke('...')`` are the Javet ways. | ||
|
||
Executor and Execute | ||
==================== | ||
|
||
In Javet, executing a script involves 2 steps. | ||
|
||
1. Get the executor. | ||
2. Call certain execute method of that executor. | ||
|
||
This is quite different from the common practice of few other libraries where execute is just a 1-step thing. | ||
|
||
Why? Javet intends to offer a builder pattern in the script execution. With an executor, application may do every other things before the actual execution. For instance: security check, enable / disable certain V8 features, hack the AST, set up interception, etc. The scope may be limited to that executor only. Also, the executor can be reused to avoid the duplicated resource loading overhead. | ||
|
||
Declarative Function Interception | ||
================================= | ||
|
||
Javet offers an easy way of registering function interception in a declarative way. Just decorate a function of arbitrary object with ``@V8Function(name = "...")``, Javet is able to register it and that function will be called back from V8. Application is free from managing those tedious things like resource leakage, object lifecycle, type conversion, etc. Javet just handles that behind the scene and everything goes smoothly. | ||
|
||
The coding experience is a little bit close to working with Spring Framework. | ||
|
||
Learn from Unit Test | ||
==================== | ||
|
||
Most of the Javet API is unit test coverted. Learning from Javet unit test is an express and effective way to Thinking in Javet. | ||
|
||
[`Home <../../README.rst>`_] [`FAQ <index.rst>`_] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.