Skip to content

An Open Source in-real-time JavaScript runner with require, multiple console methods and much more!

License

Notifications You must be signed in to change notification settings

Tecnosamba21/SamJS

Repository files navigation

SamJS

SamJS is an Open Source in-real-time JavaScript runner for testing and prototyping your JS code.

📚 Table of contents

SamJS GUI

Functionalities:

  • Instant run the code when it's modificated
  • Async functions like fetch or your custom ones
  • Import libraries using the require method
  • Code autocomplanation while you type

Import modules

You can import modules in your program by using the async method require:

require(<url>) -> Promise(<library>)

An example importing random-words:

const rw = await require('https://esm.sh/[email protected]')
console.log(rw['wordList'])

Open in SamJS 🔌

Note

You can only import libraries wich use ECMAScript modules

Use fetch

You can also use the method fetch in SamJS, for using it correctly, follow this structure:

fetch(<url>)
    .then(res => <action>)

Otherwise, you will get an empty object ({}) as the response.

An example calling the pokeapi:

fetch('https://pokeapi.co/api/v2/pokemon/ditto')
   .then(res => res.json())
   .then(response => console.log(response.name)) // Prints 'ditto'

Open in SamJS 🔌

Use the console methods -> log, info, warning, error

SamJS supports four different print methods:

console.log('This is a log')
console.info('This is some info')
console.warning('This is a warning')
console.error('This is an error')

Open in SamJS 🔌

The example in the app:

Log example

Change the theme

You can switch between dark and light modes by pressing the theme button:

Theme switching

Dark mode

Dark mode

Light mode

Light mode

About

An Open Source in-real-time JavaScript runner with require, multiple console methods and much more!

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published