Sha256: e9d6b711e36ad1d5ba1dda1efb25614922617d0f60ef07c0990244196b11a004

Contents?: true

Size: 784 Bytes

Versions: 4

Compression:

Stored size: 784 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 {
                throw `Cannot load ${lib}`
            }
        }
        return 0
    }
}

module.exports = new LoadLibraryHandler()

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
javonet-ruby-sdk-2.1.0 lib/javonet-ruby-sdk/Binaries/Nodejs/Windows/X64/core/handler/LoadLibraryHandler.js
javonet-ruby-sdk-2.0.4 lib/javonet-ruby-sdk/Binaries/Nodejs/Windows/X64/core/handler/LoadLibraryHandler.js
javonet-ruby-sdk-2.0.1 lib/javonet-ruby-sdk/Binaries/Nodejs/Windows/X64/src/core/handler/LoadLibraryHandler.js
javonet-ruby-sdk-2.0.0 lib/javonet-ruby-sdk/Binaries/Nodejs/Windows/X64/src/core/handler/LoadLibraryHandler.js