close
Skip to content

Latest commit

 

History

33 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ASuni

Access any Web API from WASM side using a clean syntax. Built using AssemblyScript.

Running

  1. Run npm install.
  2. Run npm run build ./src/main.ts or npm run build [ENTRY_FILE] or npm run build -- [MULTIPLE_ARGS].
  3. Run npm start.
  4. Go to the URL it prints out.

Example

import './ASuni';

export function run(): void {

	const person = (( {
		name: 'joe', 
		age: 20, 
		hobbies: [ 'dancing', 'singing' ], 
		isHuman: true, 
		ua: window.navigator.userAgent
	} ));

	window.console.log( person );

	const el = window.document.createElement( 'h1' );
	el.innerHTML = 'ASUNI!';
	window.document.body.appendChild( el );

	window.console.log( el.tagName );

	const json = <string>window.JSON.stringify( person );
	window.console.log( json );

	window.onclick = ( event: externref ): void => {

		window.console.log( event.target.tagName );

	};

}

Build arguments

  • Pass --noAST to not emit transformed code. Transformed files are emitted in transformed folder.
  • Pass --noUglify to not uglify imported function names.
  • For example: npm run build -- ./src/main.ts --noUglify.

Other commands

  • Use npm run dev ./src/main.ts to auto rebuild when changes are made.
  • Use npm run bundle --file=./src/main.ts to bundle everything up using esbuild. You can modify the script to use webpack if you prefer that.

About

Access any Web API in AssemblyScript using a clean syntax.

Resources

Stars

4 stars

Watchers

1 watching

Forks

Contributors

Languages