mirror of
https://github.com/boxgaming/qbjs.git
synced 2024-05-12 08:00:12 +00:00
Page:
Import
Pages
Adding Support for a New Keyword
Console.Echo
Console.Log
Console.LogLevel
Dom.Add
Dom.Alert
Dom.Confirm
Dom.Container
Dom.Create
Dom.Event
Dom.Get
Dom.GetImage
Dom.Prompt
Dom.Remove
Export
FS.DownloadFile
FS.ListDirectory
FS.UploadFile
G2D.Bezier
G2D.Curve
G2D.Ellipse
G2D.FillCircle
G2D.FillEllipse
G2D.FillRoundRect
G2D.FillTriangle
G2D.InvertRect
G2D.LineCap
G2D.LineDash
G2D.LineDashOff
G2D.LineWidth
G2D.RotoZoom
G2D.RoundRect
G2D.SaveImage
G2D.Shadow
G2D.ShadowOff
G2D.Triangle
Home
Import
QBasic Language Support
Roadmap
Samples
Storage.Clear
Storage.Get
Storage.Key
Storage.Length
Storage.Remove
Storage.Set
Supported Keywords
Unsupported Keywords
5
Import
boxgaming edited this page 2023-09-27 17:28:57 -05:00
Table of Contents
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)