Sha256: 4bc8b956acfab101069f1760799fdeef0b8257babc35cf4e5a2b8d05f3120272

Contents?: true

Size: 793 Bytes

Versions: 14

Compression:

Stored size: 793 Bytes

Contents

const AbstractHandler = require('./AbstractHandler')

class LoadLibraryHandler extends AbstractHandler {
    constructor() {
        super()
    }

    process(command) {
        let {payload} = command
        let [lib] = payload
        let pathArray = lib.split(/[/\\]/)
        let libraryName = pathArray.length > 1 ? pathArray[pathArray.length - 1] : pathArray[0]
        libraryName = libraryName.replace('.js', '')
        try {
            global[libraryName] = require(lib)
        } catch (error) {
            try {
                global[libraryName] = require(`${process.cwd()}/${lib}`)
            } catch {
                return this.process_stack_trace(error, this.constructor.name)
            }
        }
        return 0
    }
}

module.exports = new LoadLibraryHandler()

Version data entries

14 entries across 7 versions & 1 rubygems

Version Path
javonet-ruby-sdk-2.1.7 lib/javonet-ruby-sdk/Binaries/Nodejs/MacOs/X64/core/handler/LoadLibraryHandler.js
javonet-ruby-sdk-2.1.7 lib/javonet-ruby-sdk/Binaries/Nodejs/Linux/X64/core/handler/LoadLibraryHandler.js
javonet-ruby-sdk-2.1.6 lib/javonet-ruby-sdk/Binaries/Nodejs/MacOs/X64/core/handler/LoadLibraryHandler.js
javonet-ruby-sdk-2.1.6 lib/javonet-ruby-sdk/Binaries/Nodejs/Linux/X64/core/handler/LoadLibraryHandler.js
javonet-ruby-sdk-2.1.5 lib/javonet-ruby-sdk/Binaries/Nodejs/Linux/X64/core/handler/LoadLibraryHandler.js
javonet-ruby-sdk-2.1.5 lib/javonet-ruby-sdk/Binaries/Nodejs/MacOs/X64/core/handler/LoadLibraryHandler.js
javonet-ruby-sdk-2.1.4 lib/javonet-ruby-sdk/Binaries/Nodejs/MacOs/X64/core/handler/LoadLibraryHandler.js
javonet-ruby-sdk-2.1.4 lib/javonet-ruby-sdk/Binaries/Nodejs/Linux/X64/core/handler/LoadLibraryHandler.js
javonet-ruby-sdk-2.1.3 lib/javonet-ruby-sdk/Binaries/Nodejs/MacOs/X64/core/handler/LoadLibraryHandler.js
javonet-ruby-sdk-2.1.3 lib/javonet-ruby-sdk/Binaries/Nodejs/Linux/X64/core/handler/LoadLibraryHandler.js
javonet-ruby-sdk-2.1.2 lib/javonet-ruby-sdk/Binaries/Nodejs/MacOs/X64/core/handler/LoadLibraryHandler.js
javonet-ruby-sdk-2.1.2 lib/javonet-ruby-sdk/Binaries/Nodejs/Linux/X64/core/handler/LoadLibraryHandler.js
javonet-ruby-sdk-2.1.1 lib/javonet-ruby-sdk/Binaries/Nodejs/Linux/X64/core/handler/LoadLibraryHandler.js
javonet-ruby-sdk-2.1.1 lib/javonet-ruby-sdk/Binaries/Nodejs/MacOs/X64/core/handler/LoadLibraryHandler.js