Skip to content

Latest commit

 

History

History
252 lines (240 loc) · 15.5 KB

index.md

File metadata and controls

252 lines (240 loc) · 15.5 KB
metaTitle description navbar sidebar editLink pageClass
AssemblyScript
A TypeScript-like language for WebAssembly
false
false
false
frontpage

A TypeScript-like language for WebAssembly.

Get Started GitHub npm

Designed for WebAssembly

AssemblyScript targets WebAssembly's feature set specifically, giving developers low-level control over their code.

Familiar TypeScript syntax

Its similarity with TypeScript makes it easy to compile to WebAssembly without learning a new language.

Right at your fingertips

Integrates with the existing Web ecosystem - no heavy toolchains to set up. Simply npm install it!

#!runtime=stub
/** Calculates the n-th Fibonacci number. */
export function fib(n: i32): i32 {
  var a = 0, b = 1
  if (n > 0) {
    while (--n) {
      let t = a + b
      a = b
      b = t
    }
    return b
  }
  return a
}

#!html
<textarea id="output" style="height: 100%; width: 100%" readonly></textarea>
<script type="module">
const exports = await instantiate(await compile(), { /* imports */ })
const output = document.getElementById('output')
for (let i = 0; i <= 10; ++i) {
  output.value += `fib(${i}) = ${exports.fib(i)}\n`
}
</script>

AssemblyScript is free and open source software released under the Apache License, Version 2.0, builds upon Binaryen and is based on the WebAssembly specification. It is brought to you by the following awesome people:

Why AssemblyScript?

Thanks to our sponsors!

Most of the maintainers and contributors do this open source work in their free time. If you use AssemblyScript for a serious task or plan to do so, and you'd like us to invest more time on it, please donate to our OpenCollective. By sponsoring this project, your logo will show up below. Thank you so much for your support!

Join our Discord

If you have questions only a human can answer, would like to show others what you are working on or just want to hang out with other AssemblyScript folks, make sure to join our Discord server! There you'll find channels for #announcements, #help, and more.

<style scoped> #hero { margin-top: 2rem; text-align: center; height: 400px; background: #007acc; } #hero:before { content: ''; position: absolute; z-index: 0; top: 0; left: 0; width: 100%; height: 520px; background: #007acc url(/images/header.svg) center bottom no-repeat; background-size: 1440px; } #hero > * { position: relative; } #hero h1 { color: #fff; margin: 1.3rem auto 1.8rem; font-size: 2rem; font-weight: 200; } #logo { display: inline-block; width: 640px; } #logo svg { width: 100%; height: 100%; max-height: 240px; fill: #fff; } @media only screen and (max-width: 740px) { #logo { width: 100%; } #logo svg { max-height: 213px; } } #features { padding: 1.2rem 0 0; margin-top: 2.5rem; display: flex; flex-wrap: wrap; align-items: flex-start; align-content: stretch; justify-content: space-between; } #features .feature { flex-grow: 1; flex-basis: 30%; max-width: 30%; } #features h2 { font-size: 1.4rem; border-bottom: none; padding-bottom: 0; color: #3a5169; } .action { text-align: center; user-select: none; } .action a { display: inline-block; font-size: 1.2rem; color: #fff; background-color: #007acc; padding: .8rem 1.6rem; border-radius: 4px; transition: background-color .1s ease; box-sizing: border-box; border-bottom: 1px solid #006eb8; text-decoration: none !important; margin: 0.1rem 0; } .action a:hover { background-color: #1a8ae7; } .action a svg { width: 2em; position: relative; left: -10px; float: left; height: 32px; } .action a.docs { color: #111; background: #fff; border-bottom-color: #aaa; } .action a.docs:hover { background: #eee; } .action a.github { color: #fff; background: #24292e; border-bottom-color: #101214; } .action a.github:hover { background: #3e464f; } .action a.npm { color: #fff; background: #cb3837; border-bottom-color: #ba3232; } .action a.npm:hover { background: #eb3f3f; } @media only screen and (max-width: 720px) { .action a.github svg { float: none; left: 0; margin-bottom: -0.5rem; } .action a.npm { display: none; } .action a.github .title { display: none; } #features .feature { flex-basis: 100%; max-width: 100%; } } @media only screen and (max-width: 640px) { #try { display: none; } } #sponsors { margin-bottom: 2rem; } #community h2 svg { display: inline-block; height: 25px; position: relative; top: 3px; } </style> <style> .frontpage .page-edit { display: none; } </style>