New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

yaf-pluginloader

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yaf-pluginloader

PlaceHolder

latest
Source
npmnpm
Version
0.2.1
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

PluginLoader

Example

plugins/bla.plugin.ts

export default (BaseClass: ObjectConstructor) => class Bla extends BaseClass {
    bla() {
        console.log("bla")
    }
}

plugins/blu.plugin.ts

export default (BaseClass: ObjectConstructor) => class Blu extends BaseClass {
    blu() {
        console.log("blu")
    }

    test() {
        console.log("blu test")
    }
}
export const name = 'tescht'

main.ts

import NodePath from 'path'

import { PluginLoader } from "../PluginLoader"


class Test {
    test() {
        console.log("test")
    }
}


const pluginLoader = new PluginLoader(Test, {
    fileNamePart: 'plugin',
    path: NodePath.resolve(__dirname, './plugins')
})


const plugins = pluginLoader.load()
plugins.forEach(plugin => {
    console.log(plugin)
    const instance = new plugin.class()
    instance.test()
})

Keywords

plugin

FAQs

Package last updated on 10 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts