ClearScript Library
ClearScript Library
ClearScript Library Reference
Microsoft.ClearScript.V8
V8ScriptEngine Class
V8ScriptEngine Methods
CompileDocument Method
CompileDocument(String) Method
CompileDocument(String, DocumentCategory) Method
CompileDocument(String, DocumentCategory, DocumentContextCallback) Method
CompileDocument(String, V8CacheKind, Byte[]) Method
CompileDocument(String, DocumentCategory, V8CacheKind, Byte[]) Method
CompileDocument(String, V8CacheKind, Byte[], Boolean) Method
CompileDocument(String, V8CacheKind, Byte[], V8CacheResult) Method
CompileDocument(String, DocumentCategory, DocumentContextCallback, V8CacheKind, Byte[]) Method
CompileDocument(String, DocumentCategory, V8CacheKind, Byte[], Boolean) Method
CompileDocument(String, DocumentCategory, V8CacheKind, Byte[], V8CacheResult) Method
CompileDocument(String, DocumentCategory, DocumentContextCallback, V8CacheKind, Byte[], Boolean) Method
CompileDocument(String, DocumentCategory, DocumentContextCallback, V8CacheKind, Byte[], V8CacheResult) Method

# V8ScriptEngineCompileDocument(String, DocumentCategory, V8CacheKind, Byte, Boolean) Method

Loads and compiles a document with the specified category, consuming previously generated cache data.
Namespace: Microsoft.ClearScript.V8
Assembly: ClearScript.V8 (in ClearScript.V8.dll) Version: 7.5.0
Syntax
C#
VB
C++
F#
Copy

    public V8Script CompileDocument(
    	string specifier,
    	DocumentCategory category,
    	V8CacheKind cacheKind,
    	byte[] cacheBytes,
    	out bool cacheAccepted
    )

    Public Function CompileDocument (
    	specifier As String,
    	category As DocumentCategory,
    	cacheKind As V8CacheKind,
    	cacheBytes As Byte(),
    	<OutAttribute> ByRef cacheAccepted As Boolean
    ) As V8Script

    public:
    V8Script^ CompileDocument(
    	String^ specifier,
    	DocumentCategory^ category,
    	V8CacheKind cacheKind,
    	array<unsigned char>^ cacheBytes,
    	[OutAttribute] bool% cacheAccepted
    )

    member CompileDocument :
            specifier : string *
            category : DocumentCategory *
            cacheKind : V8CacheKind *
            cacheBytes : byte[] *
            cacheAccepted : bool byref -> V8Script

#### Parameters

specifier String
  A string specifying the document to be loaded and compiled.
category DocumentCategory
  An optional category for the requested document.
cacheKind V8CacheKind
  The kind of cache data to be consumed.
cacheBytes Byte
  Cache data for accelerated compilation.
cacheAccepted Boolean
  True if cacheBytes was accepted and used to accelerate script compilation, false otherwise.

#### Return Value

V8Script
A compiled script that can be executed by multiple V8 script engine instances.
Remarks
To be accepted, the cache data must have been generated for identical script code by the same V8 build. Note that script compilation may be bypassed if a suitable compiled script already exists in the V8 runtime's memory. In that case, the cache data is ignored and cacheAccepted is set to false.
See Also

#### Reference

V8ScriptEngine Class
CompileDocument Overload
Microsoft.ClearScript.V8 Namespace

Copyright © Microsoft Corporation. All rights reserved.

Send comments on this topic to Microsoft