Import - boxgaming/qbjs GitHub Wiki
Provides the ability to include library "modules" from external source files into your program.
Syntax
Import alias From sourcePath$
Parameters
- The alias specifies the prefix that will be used when referencing Functions, Subs or Consts that have been exported for use by the library.
- The sourcePath specifies the relative or absolute URL of the library module to import.
Example
Example 1: Dynamically create html elements and add them to the current page using the standard Dom library.
Import Dom From "lib/web/dom.bas"
Dim div
div = Dom.Create("div")
Dom.Create "button", div, "Push Me"
Example 2: Import user-defined libraries.
Import MyLib From "https://raw.githubusercontent.com/boxgaming/qbjs/main/samples/include/test.bas"
Import Maths From "https://raw.githubusercontent.com/boxgaming/qbjs/main/samples/include/maths.bas"
MyLib.DoStuff ' Call exported sub
Print MyLib.GetThings ' Call exported function
Print Maths.Factorial(10)
Print Maths.Plus1(11)