gp-lib
v1.0.3
Published
A general-purpose library that aims to remove boilerplate code.
Downloads
5
Readme
GP-Lib
GPL is a general-purpose library. It aims to remove boilerplate code.
List of functions ( I'm progressively adding new ones in ):
gpl.core.err(err) Logs an error to the console with the specified prefix. ( in gpl.conf.err_prefix - default: none )
gpl.core.init() Initializes the library. ( automatically called on load of the library )
gpl.core.millis() Returns amount of milliseconds passed since gpl-init.
gpl.cnv.create(width, height, [appendElem]) Returns a canvas element with specifyed width and height. If appendElem is given, gpl appends the canvas to appendElem. Examples:
let myCnv = gpl.cnv.create(300, 400, "#myCanvasContainer"); let myCnv = gpl.cnv.create(300, 400, document.getElementById("myCanvasContainer"));<br />
gpl.cnv.max(canvas) Maximizes the given canvas to window-inner-size.
gpl.check.email(email) Checks if a email is structurally correct and returns true or false.
gpl.check.mobile() Checks if the client is using a mobile device and returns true or flase.
gpl.file.download(content, name) Downloads a file with the given content and title.
gpl.convert.rgbToHex(r, g, b) Converts rgb to hex.
hexToRgb() Converts hex to rgb.