Module: Jscall

Extended by:
Interface
Defined in:
lib/jscall/version.rb,
lib/jscall.rb,
lib/jscall/browser.rb

Overview

Copyright © 2022- Shigeru Chiba. All rights reserved.

Defined Under Namespace

Modules: AsyncInterface, Interface Classes: AsyncRemoteRef, Dom, Exported, FetchServer, HiddenRef, Imported, JavaScriptError, PipeToBrowser, PipeToJs, RemoteRef

Constant Summary collapse

TableSize =
100
VERSION =
"1.4.0"
@@debug =
0

Class Method Summary collapse

Methods included from Interface

async_exec, async_funcall, dyn_import, exec, funcall, method_missing

Class Method Details

.__getpipe__Object



462
463
464
465
466
467
468
# File 'lib/jscall.rb', line 462

def self.__getpipe__
    if @pipe.nil?
        @pipe = @pipeToJsClass.new(@configurations)
        @pipe.setup(@configurations)
    end
    @pipe
end

.asyncObject



508
509
510
511
512
513
514
515
516
# File 'lib/jscall.rb', line 508

def self.async
    @async ||= Class.new do
        def __getpipe__
            Jscall.__getpipe__
        end

        include AsyncInterface
    end.new
end

.closeObject



450
451
452
# File 'lib/jscall.rb', line 450

def self.close
    @pipe = nil if @pipe.close  unless @pipe.nil?
end

.config(**kw) ⇒ Object

def self.config(module_names: [], options: ”, browser: false, sync: false)



439
440
441
442
443
444
445
446
447
448
# File 'lib/jscall.rb', line 439

def self.config(**kw)
    if kw.nil? || kw == {}
        @configurations = {}
    else
        @configurations = @configurations.merge!(kw)
    end
    browser = @configurations[:browser]
    @pipeToJsClass = if browser then PipeToBrowser else PipeToJs end
    nil
end

.debugObject

Current debug level (>= 0)



15
# File 'lib/jscall.rb', line 15

def self.debug() @@debug end

.debug=(level) ⇒ Object

Sets the current debug level.



18
19
20
# File 'lib/jscall.rb', line 18

def self.debug=(level)
    @@debug = level
end

.domObject



19
20
21
# File 'lib/jscall/browser.rb', line 19

def self.dom
    @js_dom
end

.scavenge_referencesObject

reclaim unused remote references.



458
459
460
# File 'lib/jscall.rb', line 458

def self.scavenge_references
    __getpipe__.scavenge
end