Skip to content

Module

[<Interface>]
type Module =
    abstract member children: Module array with get, set
    abstract member exports: obj with get, set
    abstract member filename: string with get, set
    abstract member id: string with get, set
    abstract member isPreloading: bool with get, set
    abstract member loaded: bool with get, set
    abstract member parent: Module option with get, set
    abstract member path: string with get, set
    abstract member paths: string array with get, set
    static member Create (children: Module array, exports: obj, filename: string, id: string, isPreloading: bool, loaded: bool, path: string, paths: string array, require: string -> obj, ?parent: Module) : Module
    abstract member require (id: string) : obj
AssemblyXantham.Fable.Node
Attributes[<Interface>]

Properties

abstract member children: Module array with get, set

The module objects required for the first time by this one.

@since v0.1.16

abstract member exports: obj with get, set

The module.exports object is created by the Module system. Sometimes this is not acceptable; many want their module to be an instance of some class. To do this, assign the desired export object to module.exports.

@since v0.1.16

abstract member filename: string with get, set

The fully resolved filename of the module.

@since v0.1.16

abstract member id: string with get, set

The identifier for the module. Typically this is the fully resolved filename.

@since v0.1.16

abstract member isPreloading: bool with get, set

true if the module is running during the Node.js preload phase.

@since v15.4.0, v14.17.0

abstract member loaded: bool with get, set

Whether or not the module is done loading, or is in the process of loading.

@since v0.1.16

abstract member parent: Module option with get, set

The module that first required this one, or null if the current module is the entry point of the current process, or undefined if the module was loaded by something that is not a CommonJS module (e.g. REPL or import).

@since v0.1.16

abstract member path: string with get, set

The directory name of the module. This is usually the same as the path.dirname() of the module.id.

@since v11.14.0

abstract member paths: string array with get, set

The search paths for the module.

@since v0.4.0

Methods

static member Create (children: Module array, exports: obj, filename: string, id: string, isPreloading: bool, loaded: bool, path: string, paths: string array, require: string -> obj, ?parent: Module) : Module
abstract member require (id: string) : obj

The module.require() method provides a way to load a module as if require() was called from the original module.

@since v0.5.1