1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-04-17 06:57:13 +02:00
Salvador Díaz Fau f764c39cc1 Replace the SetPEFlags code
Remove the outdated license text.
Use the main cef.inc file in all Delphi demos.
Fixed issue #493.
2023-11-26 19:28:28 +01:00

52 lines
1.3 KiB
ObjectPascal

unit uMyV8Accessor;
interface
uses
uCEFV8Value, uCEFv8Accessor, uCEFInterfaces, uCEFTypes;
type
TMyV8Accessor = class(TCefV8AccessorOwn)
protected
FMyVal : ustring;
function Get(const name: ustring; const object_: ICefv8Value; var retval : ICefv8Value; var exception: ustring): Boolean; override;
function Set_(const name: ustring; const object_, value: ICefv8Value; var exception: ustring): Boolean; override;
end;
implementation
function TMyV8Accessor.Get(const name : ustring;
const object_ : ICefv8Value;
var retval : ICefv8Value;
var exception : ustring): Boolean;
begin
if (name = 'myval') then
begin
retval := TCefv8ValueRef.NewString(FMyVal);
Result := True;
end
else
Result := False;
end;
function TMyV8Accessor.Set_(const name : ustring;
const object_ : ICefv8Value;
const value : ICefv8Value;
var exception : ustring): Boolean;
begin
if (name = 'myval') then
begin
if value.IsString then
FMyVal := value.GetStringValue
else
exception := 'Invalid value type';
Result := True;
end
else
Result := False;
end;
end.