Api reference
Below you can view the api reference of Visi.js
Core
lib()
-> import libraries supported by Visi
{
"usage":"lib(\"@tailwind/daisyui\")",
"libraries":[
"@tailwind/daisyui",
"@tailwind/core",
"@tailwind/pluginName",
"@react-bootstrap",
"@mui/material",
"@d3.js",
"@chart.js",
"@three.js",
"@mastercss",
"frameworls":{
"@lit-js",
},
}
}
require()
removed as of v1.4.8
let Component = require('./path/to/component')
Why remove require? - it was synchronously importing components which is slow and blocked the main thread, which caused slow downs.
dispose()
Asynchronously import components
let [El, Setel] = useState(null)
dispose('./path/to/component', (Element) =>{
Setel(Element)
// do something with El
}, {props...} || null)
ReactRouter()
bindRoot() -> set the root render element of the webpage
root() -> set the initial route of the page
options: /:param/ -> set parameters in the route can be gotten using req.params.someparam!
options /?query -> set query param in the route can be gotten using req.query.somequery!
get() -> get routes on request
options: /:param/ -> set parameters in the route can be gotten using req.params.someparam!
options /?query -> set query param in the route can be gotten using req.query.somequery!
on() -> on route change requests
options: /:param/ -> set parameters in the route can be gotten using req.params.someparam!
options /?query -> set query param in the route can be gotten using req.query.somequery!
Fs
-> Just like nodejs filesystem Visi has one for localstorage!
write('path', 'data', true - set compressed to true to compress data)
read('/path/to/file', true - decompress the compressed data)
exists('path') -> check if a path exists
mkdir('new_path') -> make a new directory
watch('file', (callback)=>{}) -> watch a file for changes
rmrf('path') -> dangerous removes the full directory be careful!
ls('path') -> list contents of directory
cp('current', 'new') -> self explanatory
pwd() -> returns root
cd('path') -> set current_directory to the directory of choice
clear() -> way more dangerous than rmrf
size('path') -> get the size of the path
rename('something', 'something') -> useless does what cp does!
contained
-> container system allowing isolated executions
newContainer('someid') -> creates a new container
run('somecode') -> execute js code
exit('id') -> self explanatory
onMessage() -> self explanatory
Last updated