WarpJS SDK Documentation | The JavaScript Full Stack Suite

WarpJS SDK Documentation | The JavaScript Full Stack Suite

›Use a warped module

Getting Started

  • Quick Start

JavaScript Virtual Cloud

  • JavaScript Virtual Cloud Introduction
  • Unified developer workflow
  • WarpJS SDK Installation
  • Build, run and develop warped modules
  • Deploy warped modules
  • Deploy static public assets
  • Glossary

Use a warped module

  • From browser using HTML
  • From browser using a builder
  • From Node.js
  • Frameworks integration

API Reference

  • Requirements
  • CLI
  • Configuration file
  • Engine
  • Infrastructure support

From Node.js

To use the warped module from a Node.js script or another Node.js module, you need first to import the warped module. You also need to import the WarpJS Engine that will provide you access to the functions of the module you want to use in your script.

Import the warped module

In order to use it from HTML, the warped module should have been build in umd format.

Then you can requires it with its path:

const MicroService = require('./warped_module.js')

Load WarpJS engine

WarpJS engine provides you the way to call functions of your warped module. You have to load it using a WarpJS engine module dependency.

Using a require

In case you cannot use or adapt your code to be asynchronous, you can directly import the engine, before requiring the warped module.

Of course you need to install it before using it

npm install @warpjs/engine

Then requires it

require('@warpjs/engine')
const MicroService = require('./warped_module.js')

Note that you have to manage yourself the dependency of the WarpJS engine that must be compatible with your warped module build.

Get warped module functions and use them

Now you have load the warped module and warp engine you can set your functions and call them.

const { hello } = new MicroService()  
// Call the function on the warped module
hello('World').then((message) => {  
  console.log(message)
})  

Full example

require('@warpjs/engine')
const MicroService = require('./warped_module.js')
const { hello } = new MicroService()  
hello('World').then((message) => {  
  console.log(message)
})  
← From browser using a builderFrameworks integration →
  • Import the warped module
  • Load WarpJS engine
    • Using a require
  • Get warped module functions and use them
  • Full example
WarpJS SDK Documentation | The JavaScript Full Stack Suite
Docs
Getting StartedAPI Reference
WarpJS
WebsiteTwitterLinkedIn
More
npmGitHubAbout Us
© ScaleDynamics - 2021