File: test/test.js

Recommend this page to a friend!
  Classes of Leonardo Mauro Pereira Moraes   Vanilla JS Require   test/test.js   Download  
File: test/test.js
Role: Example script
Content type: text/plain
Description: Example script
Class: Vanilla JS Require
Require classes in a Web browser and Node.js
Author: By
Last change: fix javascript pattern issues
Date: 2 years ago
Size: 520 bytes
 

Contents

Class file image Download
/* Include */ // Instance the vanilla-require class // - arg: directory path const vr = require("../lib.js")(__dirname); // ## Import a Vanilla JS Class console.log("testing: vanilla-require"); // Instance a Vanilla Class // - arg: file path const Calculator = vr.require("Calculator.js"); // Enjoy the Class! let myCalc = new Calculator(), a = 2, b = 3; console.log("-- Vanilla class"); console.log(myCalc); console.log("-- Using the class"); console.log("a:"+a+" b:"+b); console.log("sum:"+myCalc.sum(a, b));