+
+
+
diff --git a/CNAME b/CNAME
new file mode 100644
index 000000000..c4945bd0f
--- /dev/null
+++ b/CNAME
@@ -0,0 +1 @@
+www.assemblyscript.org
diff --git a/assets/css/0.styles.6b61c7e6.css b/assets/css/0.styles.6b61c7e6.css
new file mode 100644
index 000000000..de728ca3e
--- /dev/null
+++ b/assets/css/0.styles.6b61c7e6.css
@@ -0,0 +1 @@
+code[class*=language-],pre[class*=language-]{color:#ccc;background:none;font-family:Consolas,Monaco,Andale Mono,Ubuntu Mono,monospace;font-size:1em;word-wrap:normal;line-height:1.5}:not(pre)>code[class*=language-],pre[class*=language-]{background:#2d2d2d}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}.token.block-comment,.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#999}.token.punctuation{color:#ccc}.token.attr-name,.token.deleted,.token.namespace,.token.tag{color:#e2777a}.token.function-name{color:#6196cc}.token.boolean,.token.function,.token.number{color:#f08d49}.token.class-name,.token.constant,.token.property,.token.symbol{color:#f8c555}.token.atrule,.token.builtin,.token.important,.token.keyword,.token.selector{color:#cc99cd}.token.attr-value,.token.char,.token.regex,.token.string,.token.variable{color:#7ec699}.token.entity,.token.operator,.token.url{color:#67cdcc}.token.entity{cursor:help}.token.inserted{color:green}code[class*=language-],pre[class*=language-]{color:#393a34;font-family:Consolas,Bitstream Vera Sans Mono,Courier New,Courier,monospace;direction:ltr;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;font-size:.9em;line-height:1.2em;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-ms-hyphens:none;hyphens:none}pre>code[class*=language-]{font-size:1em}code[class*=language-]::-moz-selection,code[class*=language-] ::-moz-selection,pre[class*=language-]::-moz-selection,pre[class*=language-] ::-moz-selection{background:#c1def1}code[class*=language-]::selection,code[class*=language-] ::selection,pre[class*=language-]::selection,pre[class*=language-] ::selection{background:#c1def1}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto;border:1px solid #ddd;background-color:#fff}:not(pre)>code[class*=language-]{padding:1px .2em;background:#f8f8f8;border:1px solid #ddd}.token.cdata,.token.comment,.token.doctype,.token.prolog{color:green;font-style:italic}.token.namespace{opacity:.7}.token.string{color:#a31515}.token.operator,.token.punctuation{color:#393a34}.token.boolean,.token.constant,.token.inserted,.token.number,.token.symbol,.token.url,.token.variable{color:#36acaa}.language-autohotkey .token.selector,.language-json .token.boolean,.language-json .token.number,.token.atrule,.token.attr-value,.token.keyword,code[class*=language-css]{color:#00f}.token.function{color:#393a34}.language-autohotkey .token.tag,.token.deleted{color:#9a050f}.language-autohotkey .token.keyword,.token.selector{color:#00009f}.token.important{color:#e90}.token.bold,.token.important{font-weight:700}.token.italic{font-style:italic}.language-json .token.property,.token.class-name{color:#2b91af}.token.selector,.token.tag{color:maroon}.token.attr-name,.token.entity,.token.property,.token.regex{color:red}.token.directive.tag .tag{background:#ff0;color:#393a34}.line-numbers.line-numbers .line-numbers-rows{border-right-color:#a5a5a5}.line-numbers .line-numbers-rows>span:before{color:#2b91af}.line-highlight.line-highlight{background:rgba(193,222,241,.2);background:linear-gradient(90deg,rgba(193,222,241,.2) 70%,rgba(221,222,241,0))}.theme-default-content code{color:#476582;padding:.25rem .5rem;margin:0;font-size:.85em;background-color:rgba(27,31,35,.05);border-radius:3px}.theme-default-content code .token.deleted{color:#ec5975}.theme-default-content code .token.inserted{color:#007acc}.theme-default-content pre,.theme-default-content pre[class*=language-]{line-height:1.4;padding:1.25rem 1.5rem;margin:.85rem 0;background-color:#fff;border-radius:6px;overflow:auto}.theme-default-content pre[class*=language-] code,.theme-default-content pre code{color:#fff;padding:0;background-color:transparent;border-radius:0}div[class*=language-]{position:relative;background-color:#fff;border-radius:6px}div[class*=language-] .highlight-lines{-webkit-user-select:none;user-select:none;padding-top:1.3rem;position:absolute;top:0;left:0;width:100%;line-height:1.4}div[class*=language-] .highlight-lines .highlighted{background-color:rgba(0,0,0,.66)}div[class*=language-] pre,div[class*=language-] pre[class*=language-]{background:transparent;position:relative;z-index:1}div[class*=language-]:before{position:absolute;z-index:3;top:.8em;right:1em;font-size:.75rem;color:hsla(0,0%,100%,.4)}div[class*=language-]:not(.line-numbers-mode) .line-numbers-wrapper{display:none}div[class*=language-].line-numbers-mode .highlight-lines .highlighted{position:relative}div[class*=language-].line-numbers-mode .highlight-lines .highlighted:before{content:" ";position:absolute;z-index:3;left:0;top:0;display:block;width:3.5rem;height:100%;background-color:rgba(0,0,0,.66)}div[class*=language-].line-numbers-mode pre{padding-left:4.5rem;vertical-align:middle}div[class*=language-].line-numbers-mode .line-numbers-wrapper{position:absolute;top:0;width:3.5rem;text-align:center;color:hsla(0,0%,100%,.3);padding:1.25rem 0;line-height:1.4}div[class*=language-].line-numbers-mode .line-numbers-wrapper br{-webkit-user-select:none;user-select:none}div[class*=language-].line-numbers-mode .line-numbers-wrapper .line-number{position:relative;z-index:4;-webkit-user-select:none;user-select:none;font-size:.85em}div[class*=language-].line-numbers-mode:after{content:"";position:absolute;z-index:2;top:0;left:0;width:3.5rem;height:100%;border-radius:6px 0 0 6px;border-right:1px solid rgba(0,0,0,.66);background-color:#fff}div[class~=language-js]:before{content:"js"}div[class~=language-ts]:before{content:"ts"}div[class~=language-html]:before{content:"html"}div[class~=language-md]:before{content:"md"}div[class~=language-vue]:before{content:"vue"}div[class~=language-css]:before{content:"css"}div[class~=language-sass]:before{content:"sass"}div[class~=language-scss]:before{content:"scss"}div[class~=language-less]:before{content:"less"}div[class~=language-stylus]:before{content:"stylus"}div[class~=language-go]:before{content:"go"}div[class~=language-java]:before{content:"java"}div[class~=language-c]:before{content:"c"}div[class~=language-sh]:before{content:"sh"}div[class~=language-yaml]:before{content:"yaml"}div[class~=language-py]:before{content:"py"}div[class~=language-docker]:before{content:"docker"}div[class~=language-dockerfile]:before{content:"dockerfile"}div[class~=language-makefile]:before{content:"makefile"}div[class~=language-javascript]:before{content:"js"}div[class~=language-typescript]:before{content:"ts"}div[class~=language-markup]:before{content:"html"}div[class~=language-markdown]:before{content:"md"}div[class~=language-json]:before{content:"json"}div[class~=language-ruby]:before{content:"rb"}div[class~=language-python]:before{content:"py"}div[class~=language-bash]:before{content:"sh"}div[class~=language-php]:before{content:"php"}.custom-block .custom-block-title{font-weight:600;margin-bottom:-.4rem}.custom-block.danger,.custom-block.tip,.custom-block.warning{padding:.1rem 1.5rem;border-left-width:.5rem;border-left-style:solid;margin:1rem 0}.custom-block.tip{background-color:#f3f5f7;border-color:#42b983}.custom-block.warning{background-color:rgba(255,229,100,.3);border-color:#e7c000;color:#6b5900}.custom-block.warning .custom-block-title{color:#b29400}.custom-block.warning a{color:#2c3e50}.custom-block.danger{background-color:#ffe6e6;border-color:#c00;color:#4d0000}.custom-block.danger .custom-block-title{color:#900}.custom-block.danger a{color:#2c3e50}.custom-block.details{display:block;position:relative;border-radius:2px;margin:1.6em 0;padding:1.6em;background-color:#eee}.custom-block.details h4{margin-top:0}.custom-block.details figure:last-child,.custom-block.details p:last-child{margin-bottom:0;padding-bottom:0}.custom-block.details summary{outline:none;cursor:pointer}.arrow{display:inline-block;width:0;height:0}.arrow.up{border-bottom:6px solid #ccc}.arrow.down,.arrow.up{border-left:4px solid transparent;border-right:4px solid transparent}.arrow.down{border-top:6px solid #ccc}.arrow.right{border-left:6px solid #ccc}.arrow.left,.arrow.right{border-top:4px solid transparent;border-bottom:4px solid transparent}.arrow.left{border-right:6px solid #ccc}.theme-default-content:not(.custom){max-width:960px;margin:0 auto;padding:2rem 2.5rem}@media (max-width:959px){.theme-default-content:not(.custom){padding:2rem}}@media (max-width:419px){.theme-default-content:not(.custom){padding:1.5rem}}.table-of-contents .badge{vertical-align:middle}body,html{padding:0;margin:0;background-color:#fff}body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-size:16px;color:#2c3e50}.page{padding-left:20rem}.navbar{z-index:20;right:0;height:4.6rem;background-color:#fff;box-sizing:border-box;border-bottom:1px solid #eaecef}.navbar,.sidebar-mask{position:fixed;top:0;left:0}.sidebar-mask{z-index:9;width:100vw;height:100vh;display:none}.sidebar{font-size:16px;background-color:#fff;width:20rem;position:fixed;z-index:10;margin:0;top:4.6rem;left:0;bottom:0;box-sizing:border-box;border-right:1px solid #eaecef;overflow-y:auto}.theme-default-content:not(.custom)>:first-child{margin-top:4.6rem}.theme-default-content:not(.custom) a:hover{text-decoration:underline}.theme-default-content:not(.custom) p.demo{padding:1rem 1.5rem;border:1px solid #ddd;border-radius:4px}.theme-default-content:not(.custom) img{max-width:100%}.theme-default-content.custom{padding:0;margin:0}.theme-default-content.custom img{max-width:100%}a{font-weight:500;text-decoration:none}a,p a code{color:#007acc}p a code{font-weight:400}kbd{background:#eee;border:.15rem solid #ddd;border-bottom:.25rem solid #ddd;border-radius:.15rem;padding:0 .15em}blockquote{font-size:1rem;color:#999;border-left:.2rem solid #dfe2e5;margin:1rem 0;padding:.25rem 0 .25rem 1rem}blockquote>p{margin:0}ol,ul{padding-left:1.2em}strong{font-weight:600}h1,h2,h3,h4,h5,h6{font-weight:600;line-height:1.25}.theme-default-content:not(.custom)>h1,.theme-default-content:not(.custom)>h2,.theme-default-content:not(.custom)>h3,.theme-default-content:not(.custom)>h4,.theme-default-content:not(.custom)>h5,.theme-default-content:not(.custom)>h6{margin-top:-4.1rem;padding-top:5.6rem;margin-bottom:0}.theme-default-content:not(.custom)>h1:first-child,.theme-default-content:not(.custom)>h2:first-child,.theme-default-content:not(.custom)>h3:first-child,.theme-default-content:not(.custom)>h4:first-child,.theme-default-content:not(.custom)>h5:first-child,.theme-default-content:not(.custom)>h6:first-child{margin-top:-1.5rem;margin-bottom:1rem}.theme-default-content:not(.custom)>h1:first-child+.custom-block,.theme-default-content:not(.custom)>h1:first-child+p,.theme-default-content:not(.custom)>h1:first-child+pre,.theme-default-content:not(.custom)>h2:first-child+.custom-block,.theme-default-content:not(.custom)>h2:first-child+p,.theme-default-content:not(.custom)>h2:first-child+pre,.theme-default-content:not(.custom)>h3:first-child+.custom-block,.theme-default-content:not(.custom)>h3:first-child+p,.theme-default-content:not(.custom)>h3:first-child+pre,.theme-default-content:not(.custom)>h4:first-child+.custom-block,.theme-default-content:not(.custom)>h4:first-child+p,.theme-default-content:not(.custom)>h4:first-child+pre,.theme-default-content:not(.custom)>h5:first-child+.custom-block,.theme-default-content:not(.custom)>h5:first-child+p,.theme-default-content:not(.custom)>h5:first-child+pre,.theme-default-content:not(.custom)>h6:first-child+.custom-block,.theme-default-content:not(.custom)>h6:first-child+p,.theme-default-content:not(.custom)>h6:first-child+pre{margin-top:2rem}h1:focus .header-anchor,h1:hover .header-anchor,h2:focus .header-anchor,h2:hover .header-anchor,h3:focus .header-anchor,h3:hover .header-anchor,h4:focus .header-anchor,h4:hover .header-anchor,h5:focus .header-anchor,h5:hover .header-anchor,h6:focus .header-anchor,h6:hover .header-anchor{opacity:1}h1{font-size:2.2rem}h2{font-size:1.65rem;padding-bottom:.3rem;border-bottom:1px solid #eaecef}h3{font-size:1.35rem}a.header-anchor{font-size:.85em;float:left;margin-left:-.87em;padding-right:.23em;margin-top:.125em;opacity:0}a.header-anchor:focus,a.header-anchor:hover{text-decoration:none}.line-number,code,kbd{font-family:source-code-pro,Menlo,Monaco,Consolas,Courier New,monospace}ol,p,ul{line-height:1.7}hr{border:0;border-top:1px solid #eaecef}table{border-collapse:collapse;margin:1rem 0;display:block;overflow-x:auto}tr{border-top:1px solid #dfe2e5}tr:nth-child(2n){background-color:#f6f8fa}td,th{border:1px solid #dfe2e5;padding:.6em 1em}.theme-container.sidebar-open .sidebar-mask{display:block}.theme-container.no-navbar .theme-default-content:not(.custom)>h1,.theme-container.no-navbar h2,.theme-container.no-navbar h3,.theme-container.no-navbar h4,.theme-container.no-navbar h5,.theme-container.no-navbar h6{margin-top:1.5rem;padding-top:0}.theme-container.no-navbar .sidebar{top:0}@media (min-width:720px){.theme-container.no-sidebar .sidebar{display:none}.theme-container.no-sidebar .page{padding-left:0}}@media (max-width:959px){.sidebar{font-size:15px;width:16.4rem}.page{padding-left:16.4rem}}@media (max-width:719px){.sidebar{top:0;padding-top:4.6rem;transform:translateX(-100%);transition:transform .2s ease}.page{padding-left:0}.theme-container.sidebar-open .sidebar{transform:translateX(0)}.theme-container.no-navbar .sidebar{padding-top:0}}@media (max-width:419px){h1{font-size:1.9rem}.theme-default-content div[class*=language-]{margin:.85rem -1.5rem;border-radius:0}}.sidebar::-webkit-scrollbar{width:.3em}.sidebar::-webkit-scrollbar-track{background-color:#eaecef}.sidebar::-webkit-scrollbar-thumb{background-color:#007acc}.sidebar-group:is(.collapsable) .sidebar-heading{opacity:1!important;cursor:pointer!important}.nav-dropdown .dropdown-item h4{margin:.45rem 0 .2rem!important}.token.builtin{color:#36acaa}.token.comment{font-style:normal}.theme-default-content a code{color:#007acc}.theme-default-content pre[class*=language-] code,.theme-default-content pre code{color:#222;color:#476582;font-size:1em}div[class*=language-]:before{color:#fff;background:#bbb;padding:1px 4px 3px 5px}div[class~=language-ts]:before,div[class~=language-typescript]:before{color:#fff;background:#007acc}div[class~=language-javascript]:before,div[class~=language-js]:before{color:#323330;background:#f0db4f}div[class~=language-bash]:before,div[class~=language-sh]:before{color:#fff;background:#000}div[class~=language-wat]:before,div[class~=language-webassembly]:before{color:#fff;background:#654ff0}div[class~=language-html]:before{color:#fff;background:#e44d26}div[class~=language-c]:before{color:#fff;background:#3949ab;padding-right:6px;padding-left:7px}.theme-default-content li div[class*=language-]:first-child pre[class*=language-]{background:#fff;border:0;padding:0;font-size:1.1em}.theme-default-content li div[class*=language-]:first-child:before{display:none}img.engine{position:relative;top:3px}details summary{cursor:pointer}details summary::marker{color:#ccc}details summary:hover{color:#007acc}details table td{font-family:source-code-pro,Menlo,Monaco,Consolas,Courier New,monospace}#nprogress{pointer-events:none}#nprogress .bar{background:#007acc;position:fixed;z-index:1031;top:0;left:0;width:100%;height:2px}#nprogress .peg{display:block;position:absolute;right:0;width:100px;height:100%;box-shadow:0 0 10px #007acc,0 0 5px #007acc;opacity:1;transform:rotate(3deg) translateY(-4px)}#nprogress .spinner{display:block;position:fixed;z-index:1031;top:15px;right:15px}#nprogress .spinner-icon{width:18px;height:18px;box-sizing:border-box;border-color:#007acc transparent transparent #007acc;border-style:solid;border-width:2px;border-radius:50%;-webkit-animation:nprogress-spinner .4s linear infinite;animation:nprogress-spinner .4s linear infinite}.nprogress-custom-parent{overflow:hidden;position:relative}.nprogress-custom-parent #nprogress .bar,.nprogress-custom-parent #nprogress .spinner{position:absolute}@-webkit-keyframes nprogress-spinner{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}@keyframes nprogress-spinner{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.icon.outbound{color:#aaa;display:inline-block;vertical-align:middle;position:relative;top:-1px}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.home{padding:4.6rem 2rem 0;max-width:960px;margin:0 auto;display:block}.home .hero{text-align:center}.home .hero img{max-width:100%;max-height:280px;display:block;margin:3rem auto 1.5rem}.home .hero h1{font-size:3rem}.home .hero .action,.home .hero .description,.home .hero h1{margin:1.8rem auto}.home .hero .description{max-width:35rem;font-size:1.6rem;line-height:1.3;color:#6a8bad}.home .hero .action-button{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}.home .hero .action-button:hover{background-color:#008ceb}.home .features{border-top:1px solid #eaecef;padding:1.2rem 0;margin-top:2.5rem;display:flex;flex-wrap:wrap;align-items:flex-start;align-content:stretch;justify-content:space-between}.home .feature{flex-grow:1;flex-basis:30%;max-width:30%}.home .feature h2{font-size:1.4rem;font-weight:500;border-bottom:none;padding-bottom:0;color:#3a5169}.home .feature p{color:#4e6e8e}.home .footer{padding:2.5rem;border-top:1px solid #eaecef;text-align:center;color:#4e6e8e}@media (max-width:719px){.home .features{flex-direction:column}.home .feature{max-width:100%;padding:0 2.5rem}}@media (max-width:419px){.home{padding-left:1.5rem;padding-right:1.5rem}.home .hero img{max-height:210px;margin:2rem auto 1.2rem}.home .hero h1{font-size:2rem}.home .hero .action,.home .hero .description,.home .hero h1{margin:1.2rem auto}.home .hero .description{font-size:1.2rem}.home .hero .action-button{font-size:1rem;padding:.6rem 1.2rem}.home .feature h2{font-size:1.25rem}}.algolia-search-wrapper>span{vertical-align:middle}.algolia-search-wrapper .algolia-autocomplete{line-height:normal}.algolia-search-wrapper .algolia-autocomplete .ds-dropdown-menu{background-color:#fff;border:1px solid #999;border-radius:4px;font-size:16px;margin:6px 0 0;padding:4px;text-align:left}.algolia-search-wrapper .algolia-autocomplete .ds-dropdown-menu:before{border-color:#999}.algolia-search-wrapper .algolia-autocomplete .ds-dropdown-menu [class*=ds-dataset-]{border:none;padding:0}.algolia-search-wrapper .algolia-autocomplete .ds-dropdown-menu .ds-suggestions{margin-top:0}.algolia-search-wrapper .algolia-autocomplete .ds-dropdown-menu .ds-suggestion{border-bottom:1px solid #eaecef}.algolia-search-wrapper .algolia-autocomplete .algolia-docsearch-suggestion--highlight{color:#2c815b}.algolia-search-wrapper .algolia-autocomplete .algolia-docsearch-suggestion{border-color:#eaecef;padding:0}.algolia-search-wrapper .algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--category-header{padding:5px 10px;margin-top:0;background:#007acc;color:#fff;font-weight:600}.algolia-search-wrapper .algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--category-header .algolia-docsearch-suggestion--highlight{background:hsla(0,0%,100%,.6)}.algolia-search-wrapper .algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--wrapper{padding:0}.algolia-search-wrapper .algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--title{font-weight:600;margin-bottom:0;color:#2c3e50}.algolia-search-wrapper .algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--subcategory-column{vertical-align:top;padding:5px 7px 5px 5px;border-color:#eaecef;background:#f1f3f5}.algolia-search-wrapper .algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--subcategory-column:after{display:none}.algolia-search-wrapper .algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--subcategory-column-text{color:#555}.algolia-search-wrapper .algolia-autocomplete .algolia-docsearch-footer{border-color:#eaecef}.algolia-search-wrapper .algolia-autocomplete .ds-cursor .algolia-docsearch-suggestion--content{background-color:#e7edf3!important;color:#2c3e50}@media (min-width:719px){.algolia-search-wrapper .algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--subcategory-column{float:none;width:150px;min-width:150px;display:table-cell}.algolia-search-wrapper .algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--content{float:none;display:table-cell;width:100%;vertical-align:top}.algolia-search-wrapper .algolia-autocomplete .algolia-docsearch-suggestion .ds-dropdown-menu{min-width:515px!important}}@media (max-width:719px){.algolia-search-wrapper .ds-dropdown-menu{min-width:calc(100vw - 4rem)!important;max-width:calc(100vw - 4rem)!important}.algolia-search-wrapper .algolia-docsearch-suggestion--wrapper{padding:5px 7px 5px 5px!important}.algolia-search-wrapper .algolia-docsearch-suggestion--subcategory-column{padding:0!important;background:#fff!important}.algolia-search-wrapper .algolia-docsearch-suggestion--subcategory-column-text:after{content:" > ";font-size:10px;line-height:14.4px;display:inline-block;width:5px;margin:-3px 3px 0;vertical-align:middle}}.search-box{display:inline-block;position:relative;margin-right:1rem}.search-box input{cursor:text;width:10rem;height:2rem;color:#4e6e8e;display:inline-block;border:1px solid #cfd4db;border-radius:2rem;font-size:.9rem;line-height:2rem;padding:0 .5rem 0 2rem;outline:none;transition:all .2s ease;background:#fff url(/assets/img/search.83621669.svg) .6rem .5rem no-repeat;background-size:1rem}.search-box input:focus{cursor:auto;border-color:#007acc}.search-box .suggestions{background:#fff;width:20rem;position:absolute;top:2rem;border:1px solid #cfd4db;border-radius:6px;padding:.4rem;list-style-type:none}.search-box .suggestions.align-right{right:0}.search-box .suggestion{line-height:1.4;padding:.4rem .6rem;border-radius:4px;cursor:pointer}.search-box .suggestion a{white-space:normal;color:#5d82a6}.search-box .suggestion a .page-title{font-weight:600}.search-box .suggestion a .header{font-size:.9em;margin-left:.25em}.search-box .suggestion.focused{background-color:#f3f4f5}.search-box .suggestion.focused a{color:#007acc}@media (max-width:959px){.search-box input{cursor:pointer;width:0;border-color:transparent;position:relative}.search-box input:focus{cursor:text;left:0;width:10rem}}@media (-ms-high-contrast:none){.search-box input{height:2rem}}@media (max-width:959px) and (min-width:719px){.search-box .suggestions{left:0}}@media (max-width:719px){.search-box{margin-right:0}.search-box input{left:1rem}.search-box .suggestions{right:0}}@media (max-width:419px){.search-box .suggestions{width:calc(100vw - 4rem)}.search-box input:focus{width:8rem}}.sidebar-button{cursor:pointer;display:none;width:1.25rem;height:1.25rem;position:absolute;padding:.6rem;top:.6rem;left:1rem}.sidebar-button .icon{display:block;width:1.25rem;height:1.25rem}@media (max-width:719px){.sidebar-button{display:block}}.dropdown-enter,.dropdown-leave-to{height:0!important}.dropdown-wrapper{cursor:pointer}.dropdown-wrapper .dropdown-title,.dropdown-wrapper .mobile-dropdown-title{display:block;font-size:.9rem;font-family:inherit;cursor:inherit;padding:inherit;line-height:1.4rem;background:transparent;border:none;font-weight:500;color:#2c3e50}.dropdown-wrapper .dropdown-title:hover,.dropdown-wrapper .mobile-dropdown-title:hover{border-color:transparent}.dropdown-wrapper .dropdown-title .arrow,.dropdown-wrapper .mobile-dropdown-title .arrow{vertical-align:middle;margin-top:-1px;margin-left:.4rem}.dropdown-wrapper .mobile-dropdown-title{display:none;font-weight:600}.dropdown-wrapper .mobile-dropdown-title font-size inherit:hover{color:#007acc}.dropdown-wrapper .nav-dropdown .dropdown-item{color:inherit;line-height:1.7rem}.dropdown-wrapper .nav-dropdown .dropdown-item h4{margin:.45rem 0 0;border-top:1px solid #eee;padding:1rem 1.5rem .45rem 1.25rem}.dropdown-wrapper .nav-dropdown .dropdown-item .dropdown-subitem-wrapper{padding:0;list-style:none}.dropdown-wrapper .nav-dropdown .dropdown-item .dropdown-subitem-wrapper .dropdown-subitem{font-size:.9em}.dropdown-wrapper .nav-dropdown .dropdown-item a{display:block;line-height:1.7rem;position:relative;border-bottom:none;font-weight:400;margin-bottom:0;padding:0 1.5rem 0 1.25rem}.dropdown-wrapper .nav-dropdown .dropdown-item a.router-link-active,.dropdown-wrapper .nav-dropdown .dropdown-item a:hover{color:#007acc}.dropdown-wrapper .nav-dropdown .dropdown-item a.router-link-active:after{content:"";width:0;height:0;border-left:5px solid #007acc;border-top:3px solid transparent;border-bottom:3px solid transparent;position:absolute;top:calc(50% - 2px);left:9px}.dropdown-wrapper .nav-dropdown .dropdown-item:first-child h4{margin-top:0;padding-top:0;border-top:0}@media (max-width:719px){.dropdown-wrapper.open .dropdown-title{margin-bottom:.5rem}.dropdown-wrapper .dropdown-title{display:none}.dropdown-wrapper .mobile-dropdown-title{display:block}.dropdown-wrapper .nav-dropdown{transition:height .1s ease-out;overflow:hidden}.dropdown-wrapper .nav-dropdown .dropdown-item h4{border-top:0;margin-top:0;padding-top:0}.dropdown-wrapper .nav-dropdown .dropdown-item>a,.dropdown-wrapper .nav-dropdown .dropdown-item h4{font-size:15px;line-height:2rem}.dropdown-wrapper .nav-dropdown .dropdown-item .dropdown-subitem{font-size:14px;padding-left:1rem}}@media (min-width:719px){.dropdown-wrapper{height:1.8rem}.dropdown-wrapper.open .nav-dropdown,.dropdown-wrapper:hover .nav-dropdown{display:block!important}.dropdown-wrapper.open:blur{display:none}.dropdown-wrapper .nav-dropdown{display:none;height:auto!important;box-sizing:border-box;max-height:calc(100vh - 2.7rem);overflow-y:auto;position:absolute;top:100%;right:0;background-color:#fff;padding:.6rem 0;border:1px solid;border-color:#ddd #ddd #ccc;text-align:left;border-radius:.25rem;white-space:nowrap;margin:0}}.nav-links{display:inline-block}.nav-links a{line-height:1.4rem;color:inherit}.nav-links a.router-link-active,.nav-links a:hover{color:#007acc}.nav-links .nav-item{position:relative;display:inline-block;margin-left:1.5rem;line-height:2rem}.nav-links .nav-item:first-child{margin-left:0}.nav-links .repo-link{margin-left:1.5rem}@media (max-width:719px){.nav-links .nav-item,.nav-links .repo-link{margin-left:0}}@media (min-width:719px){.nav-links a.router-link-active,.nav-links a:hover{color:#2c3e50}.nav-item>a:not(.external).router-link-active,.nav-item>a:not(.external):hover{margin-bottom:-2px;border-bottom:2px solid #0089e4}}.navbar{padding:.7rem 1.5rem;line-height:3.2rem}.navbar a,.navbar img,.navbar span{display:inline-block}.navbar .logo{height:3.2rem;min-width:3.2rem;margin-right:.8rem;vertical-align:top}.navbar .site-name{font-size:1.3rem;font-weight:600;color:#2c3e50;position:relative}.navbar .links{padding-left:1.5rem;box-sizing:border-box;background-color:#fff;white-space:nowrap;font-size:.9rem;position:absolute;right:1.5rem;top:.7rem;display:flex}.navbar .links .search-box{flex:0 0 auto;vertical-align:top}@media (max-width:719px){.navbar{padding-left:4rem}.navbar .can-hide{display:none}.navbar .links{padding-left:1.5rem}.navbar .site-name{width:calc(100vw - 9.4rem);overflow:hidden;white-space:nowrap;text-overflow:ellipsis}}.page-edit{max-width:960px;margin:0 auto;padding:2rem 2.5rem}@media (max-width:959px){.page-edit{padding:2rem}}@media (max-width:419px){.page-edit{padding:1.5rem}}.page-edit{padding-top:1rem;padding-bottom:1rem;overflow:auto}.page-edit .edit-link{display:inline-block}.page-edit .edit-link a{color:#4e6e8e;margin-right:.25rem}.page-edit .last-updated{float:right;font-size:.9em}.page-edit .last-updated .prefix{font-weight:500;color:#4e6e8e}.page-edit .last-updated .time{font-weight:400;color:#767676}@media (max-width:719px){.page-edit .edit-link{margin-bottom:.5rem}.page-edit .last-updated{font-size:.8em;float:none;text-align:left}}.page-nav{max-width:960px;margin:0 auto;padding:2rem 2.5rem}@media (max-width:959px){.page-nav{padding:2rem}}@media (max-width:419px){.page-nav{padding:1.5rem}}.page-nav{padding-top:1rem;padding-bottom:0}.page-nav .inner{min-height:2rem;margin-top:0;border-top:1px solid #eaecef;padding-top:1rem;overflow:auto}.page-nav .next{float:right}.page{padding-bottom:2rem;display:block}.page[data-v-bb3fd134]{padding-bottom:0}.editor-wrap{position:relative;-webkit-margin-before:1em;margin-block-start:1em;-webkit-margin-after:1em;margin-block-end:1em}.editor-wrap a.maximize{position:absolute;top:8px;right:12px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;color:#c7c4c7;cursor:pointer;font-size:1.2rem;z-index:1000}.editor-wrap a.maximize:hover{color:#fff;text-decoration:none}.editor-wrap iframe{background:#1e1e1e;width:100%;height:540px;min-height:540px;border:0;resize:vertical}.editor-wrap.maximized{position:fixed;-webkit-margin-before:auto;margin-block-start:auto;-webkit-margin-after:auto;margin-block-end:auto;z-index:9000;margin:0;top:0;left:0;height:100%;width:100%}.editor-wrap.maximized iframe{height:100%!important;resize:none}.sidebar-group .sidebar-group{padding-left:.5em}.sidebar-group:not(.collapsable) .sidebar-heading:not(.clickable){cursor:auto;color:inherit}.sidebar-group.is-sub-group{padding-left:0}.sidebar-group.is-sub-group>.sidebar-heading{font-size:.95em;line-height:1.4;font-weight:400;padding-left:2rem}.sidebar-group.is-sub-group>.sidebar-heading:not(.clickable){opacity:.5}.sidebar-group.is-sub-group>.sidebar-group-items{padding-left:1rem}.sidebar-group.is-sub-group>.sidebar-group-items>li>.sidebar-link{font-size:.95em;border-left:none}.sidebar-group.depth-2>.sidebar-heading{border-left:none}.sidebar-heading{color:#2c3e50;transition:color .15s ease;cursor:pointer;font-size:1.1em;font-weight:700;padding:.35rem 1.5rem .35rem 1.25rem;width:100%;box-sizing:border-box;margin:0;border-left:.25rem solid transparent}.sidebar-heading.open,.sidebar-heading:hover{color:inherit}.sidebar-heading .arrow{position:relative;top:-.12em;left:.5em}.sidebar-heading.clickable.active{font-weight:600;color:#007acc;border-left-color:#007acc}.sidebar-heading.clickable:hover{color:#007acc}.sidebar-group-items{transition:height .1s ease-out;font-size:.95em;overflow:hidden}.sidebar .sidebar-sub-headers{padding-left:1rem;font-size:.95em}a.sidebar-link{font-size:1em;font-weight:400;display:inline-block;color:#2c3e50;border-left:.25rem solid transparent;padding:.35rem 1rem .35rem 1.25rem;line-height:1.4;width:100%;box-sizing:border-box}a.sidebar-link:hover{color:#007acc}a.sidebar-link.active{font-weight:600;color:#007acc;border-left-color:#007acc}.sidebar-group a.sidebar-link{padding-left:2rem}.sidebar-sub-headers a.sidebar-link{padding-top:.25rem;padding-bottom:.25rem;border-left:none}.sidebar-sub-headers a.sidebar-link.active{font-weight:500}.sidebar ul{padding:0;margin:0;list-style-type:none}.sidebar a{display:inline-block}.sidebar .nav-links{display:none;border-bottom:1px solid #eaecef;padding:.5rem 0 .75rem}.sidebar .nav-links a{font-weight:600}.sidebar .nav-links .nav-item,.sidebar .nav-links .repo-link{display:block;line-height:1.25rem;font-size:1.1em;padding:.5rem 0 .5rem 1.5rem}.sidebar>.sidebar-links{padding:1.5rem 0}.sidebar>.sidebar-links>li>a.sidebar-link{font-size:1.1em;line-height:1.7;font-weight:700}.sidebar>.sidebar-links>li:not(:first-child){margin-top:.75rem}@media (max-width:719px){.sidebar .nav-links{display:block}.sidebar .nav-links .dropdown-wrapper .nav-dropdown .dropdown-item a.router-link-active:after{top:calc(1rem - 2px)}.sidebar>.sidebar-links{padding:1rem 0}}.footer[data-v-7c0e63ba]{text-align:center;color:#4e6e8e;padding:0 2rem}.footer .item[data-v-7c0e63ba]{white-space:nowrap}#hero[data-v-0f93345e]{margin-top:2rem;text-align:center;height:400px;background:#007acc}#hero[data-v-0f93345e]:before{content:"";position:absolute;z-index:0;top:0;left:0;width:100%;height:520px;background:#007acc url(/images/header.svg) bottom no-repeat;background-size:1440px}#hero>[data-v-0f93345e]{position:relative}#hero h1[data-v-0f93345e]{color:#fff;margin:1.3rem auto 1.8rem;font-size:2rem;font-weight:200}#logo[data-v-0f93345e]{display:inline-block;width:640px}#logo svg[data-v-0f93345e]{width:100%;height:100%;max-height:240px;fill:#fff}@media only screen and (max-width:740px){#logo[data-v-0f93345e]{width:100%}#logo svg[data-v-0f93345e]{max-height:213px}}#features[data-v-0f93345e]{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[data-v-0f93345e]{flex-grow:1;flex-basis:30%;max-width:30%}#features h2[data-v-0f93345e]{font-size:1.4rem;border-bottom:none;padding-bottom:0;color:#3a5169}.action[data-v-0f93345e]{text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.action a[data-v-0f93345e]{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:.1rem 0}.action a[data-v-0f93345e]:hover{background-color:#1a8ae7}.action a svg[data-v-0f93345e]{width:2em;position:relative;left:-10px;float:left;height:32px}.action a.docs[data-v-0f93345e]{color:#111;background:#fff;border-bottom-color:#aaa}.action a.docs[data-v-0f93345e]:hover{background:#eee}.action a.github[data-v-0f93345e]{color:#fff;background:#24292e;border-bottom-color:#101214}.action a.github[data-v-0f93345e]:hover{background:#3e464f}.action a.npm[data-v-0f93345e]{color:#fff;background:#cb3837;border-bottom-color:#ba3232}.action a.npm[data-v-0f93345e]:hover{background:#eb3f3f}@media only screen and (max-width:720px){.action a.github svg[data-v-0f93345e]{float:none;left:0;margin-bottom:-.5rem}.action a.github .title[data-v-0f93345e],.action a.npm[data-v-0f93345e]{display:none}#features .feature[data-v-0f93345e]{flex-basis:100%;max-width:100%}}@media only screen and (max-width:640px){#try[data-v-0f93345e]{display:none}}#sponsors[data-v-0f93345e]{margin-bottom:2rem}#community h2 svg[data-v-0f93345e]{display:inline-block;height:25px;position:relative;top:3px}.frontpage .page-edit{display:none}.community .list[data-v-181c7660]{text-align:center}.community .list a[data-v-181c7660]{display:inline-block;box-sizing:border-box;position:relative;top:0;transition:top .1s}.community .list a[data-v-181c7660]:hover{top:-4px}.community .list a[data-v-181c7660]:before{content:"";position:absolute;border-radius:50%;background:#999;bottom:2px;right:2px;width:10px;height:10px;border:2px solid #fff}.community .list a.online[data-v-181c7660]:before{background:#49b684}.community .list a.idle[data-v-181c7660]:before{background:#fff url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMCAxMCI+PHBhdGggZD0iTTUgMGE1IDUgMCAwMC0xLjA1OS4xMkEzLjA5IDMuMDkgMCAwMTYuMTggMy4wODdhMy4wOSAzLjA5IDAgMDEtMy4wOSAzLjA5QTMuMDkgMy4wOSAwIDAxLjEyIDMuOTMgNSA1IDAgMDAwIDVhNSA1IDAgMDA1IDUgNSA1IDAgMDA1LTUgNSA1IDAgMDAtNS01eiIgZmlsbD0iI2Y4YTczNSIvPjwvc3ZnPg==");background-size:10px 10px}.community .list a.dnd[data-v-181c7660]:before{background:#fff url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMCAxMCI+PHBhdGggZD0iTTUgMGE1IDUgMCAwMC01IDUgNSA1IDAgMDA1IDUgNSA1IDAgMDA1LTUgNSA1IDAgMDAtNS01ek0yIDRoNnYySDJWNHoiIGZpbGw9IiNlZDQ3NGEiLz48L3N2Zz4=");background-size:10px 10px}.community .list img[data-v-181c7660]{width:32px;height:32px;overflow:hidden;border-radius:50%;border:1px solid #fff;box-shadow:0 0 0 1px #007acc}.community .list a[data-v-181c7660]{padding:.15rem}.contributors h3[data-v-31cd9d1c]{text-align:center;border:0}.contributors .list[data-v-31cd9d1c]{text-align:center}.contributors .list a[data-v-31cd9d1c]{display:inline-block;box-sizing:border-box;position:relative;top:0;transition:top .1s}.contributors .list a[data-v-31cd9d1c]:hover{top:-4px}.contributors .list img[data-v-31cd9d1c]{width:32px;height:32px;overflow:hidden;border-radius:50%;border:1px solid #fff;box-shadow:0 0 0 1px #007acc}.contributors .list a[data-v-31cd9d1c]{padding:.15rem}.sponsors[data-v-7f9b29e8]{border:1px solid #eaecef;background:#fff;padding:0 .5rem 1.5rem}.sponsors h3[data-v-7f9b29e8]{text-align:center;border:0}.sponsors .list[data-v-7f9b29e8]{text-align:center}.sponsors .list a[data-v-7f9b29e8]{display:inline-block;box-sizing:border-box;position:relative;top:0;transition:top .1s}.sponsors .list img[data-v-7f9b29e8]{overflow:hidden}.sponsors .list a[data-v-7f9b29e8]:hover{top:-4px}.sponsors .platinum .list img[data-v-7f9b29e8]{height:80px}.sponsors .platinum .list a[data-v-7f9b29e8]{padding:.5rem}.sponsors .gold .list img[data-v-7f9b29e8]{height:64px}.sponsors .gold .list a[data-v-7f9b29e8]{padding:.5rem}.sponsors .silver .list img[data-v-7f9b29e8]{height:48px}.sponsors .silver .list a[data-v-7f9b29e8]{padding:.4rem}.sponsors .bronze .list img[data-v-7f9b29e8]{height:36px}.sponsors .bronze .list a[data-v-7f9b29e8]{padding:.3rem}.sponsors .backer .list img[data-v-7f9b29e8]{width:32px;height:32px;border-radius:50%;border:1px solid #fff;box-shadow:0 0 0 1px #007acc}.sponsors .backer .list a[data-v-7f9b29e8]{padding:.15rem}.testimonials[data-v-aebe12ce]{padding-bottom:1rem}.testimonials h3[data-v-aebe12ce]{text-align:center;border:0}.testimonial[data-v-aebe12ce]{display:flex;flex-direction:row;align-items:center;padding:1.5rem 0;margin:0 0 0 30px}.testimonial .logo[data-v-aebe12ce]{border-radius:50%;width:76px;height:76px;border:1px solid #fff;box-shadow:0 0 0 1px #007acc}.testimonial p[data-v-aebe12ce]{margin:0 30px;text-align:justify}@media only screen and (max-width:720px){.testimonial[data-v-aebe12ce]{flex-direction:column;margin:0}.testimonial .logo[data-v-aebe12ce]{width:90px;height:90px}.testimonial p[data-v-aebe12ce]{margin:20px 0 10px}}.badge[data-v-15b7b770]{display:inline-block;font-size:14px;height:18px;line-height:18px;border-radius:3px;padding:0 6px;color:#fff}.badge.green[data-v-15b7b770],.badge.tip[data-v-15b7b770],.badge[data-v-15b7b770]{background-color:#42b983}.badge.error[data-v-15b7b770]{background-color:#da5961}.badge.warn[data-v-15b7b770],.badge.warning[data-v-15b7b770],.badge.yellow[data-v-15b7b770]{background-color:#e7c000}.badge+.badge[data-v-15b7b770]{margin-left:5px}.theme-code-block[data-v-759a7d02]{display:none}.theme-code-block__active[data-v-759a7d02]{display:block}.theme-code-block>pre[data-v-759a7d02]{background-color:orange}.theme-code-group__nav[data-v-deefee04]{margin-bottom:-35px;background-color:#fff;padding-bottom:22px;border-top-left-radius:6px;border-top-right-radius:6px;padding-left:10px;padding-top:10px}.theme-code-group__ul[data-v-deefee04]{margin:auto 0;padding-left:0;display:inline-flex;list-style:none}.theme-code-group__nav-tab[data-v-deefee04]{border:0;padding:5px;cursor:pointer;background-color:transparent;font-size:.85em;line-height:1.4;color:hsla(0,0%,100%,.9);font-weight:600}.theme-code-group__nav-tab-active[data-v-deefee04]{border-bottom:1px solid #42b983}.pre-blank[data-v-deefee04]{color:#42b983}.searchbox{display:inline-block;position:relative;width:200px;height:32px!important;white-space:nowrap;box-sizing:border-box;visibility:visible!important}.searchbox .algolia-autocomplete{display:block;width:100%;height:100%}.searchbox__wrapper{width:100%;height:100%;z-index:999;position:relative}.searchbox__input{display:inline-block;box-sizing:border-box;transition:box-shadow .4s ease,background .4s ease;border:0;border-radius:16px;box-shadow:inset 0 0 0 1px #ccc;background:#fff!important;padding:0 26px 0 32px;width:100%;height:100%;vertical-align:middle;white-space:normal;font-size:12px;-webkit-appearance:none;-moz-appearance:none;appearance:none}.searchbox__input::-webkit-search-cancel-button,.searchbox__input::-webkit-search-decoration,.searchbox__input::-webkit-search-results-button,.searchbox__input::-webkit-search-results-decoration{display:none}.searchbox__input:hover{box-shadow:inset 0 0 0 1px #b3b3b3}.searchbox__input:active,.searchbox__input:focus{outline:0;box-shadow:inset 0 0 0 1px #aaa;background:#fff}.searchbox__input:-ms-input-placeholder{color:#aaa}.searchbox__input::-moz-placeholder{color:#aaa}.searchbox__input::placeholder{color:#aaa}.searchbox__submit{position:absolute;top:0;margin:0;border:0;border-radius:16px 0 0 16px;background-color:rgba(69,142,225,0);padding:0;width:32px;height:100%;vertical-align:middle;text-align:center;font-size:inherit;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;right:inherit;left:0}.searchbox__submit:before{display:inline-block;margin-right:-4px;height:100%;vertical-align:middle;content:""}.searchbox__submit:active,.searchbox__submit:hover{cursor:pointer}.searchbox__submit:focus{outline:0}.searchbox__submit svg{width:14px;height:14px;vertical-align:middle;fill:#6d7e96}.searchbox__reset{display:block;position:absolute;top:8px;right:8px;margin:0;border:0;background:none;cursor:pointer;padding:0;font-size:inherit;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;fill:rgba(0,0,0,.5)}.searchbox__reset.hide{display:none}.searchbox__reset:focus{outline:0}.searchbox__reset svg{display:block;margin:4px;width:8px;height:8px}.searchbox__input:valid~.searchbox__reset{display:block;-webkit-animation-name:sbx-reset-in;animation-name:sbx-reset-in;-webkit-animation-duration:.15s;animation-duration:.15s}@-webkit-keyframes sbx-reset-in{0%{transform:translate3d(-20%,0,0);opacity:0}to{transform:none;opacity:1}}@keyframes sbx-reset-in{0%{transform:translate3d(-20%,0,0);opacity:0}to{transform:none;opacity:1}}.algolia-autocomplete.algolia-autocomplete-right .ds-dropdown-menu{right:0!important;left:inherit!important}.algolia-autocomplete.algolia-autocomplete-right .ds-dropdown-menu:before{right:48px}.algolia-autocomplete.algolia-autocomplete-left .ds-dropdown-menu{left:0!important;right:inherit!important}.algolia-autocomplete.algolia-autocomplete-left .ds-dropdown-menu:before{left:48px}.algolia-autocomplete .ds-dropdown-menu{top:-6px;border-radius:4px;margin:6px 0 0;padding:0;text-align:left;height:auto;position:relative;background:transparent;border:none;z-index:999;max-width:600px;min-width:500px;box-shadow:0 1px 0 0 rgba(0,0,0,.2),0 2px 3px 0 rgba(0,0,0,.1)}.algolia-autocomplete .ds-dropdown-menu:before{display:block;position:absolute;content:"";width:14px;height:14px;background:#fff;z-index:1000;top:-7px;border-top:1px solid #d9d9d9;border-right:1px solid #d9d9d9;transform:rotate(-45deg);border-radius:2px}.algolia-autocomplete .ds-dropdown-menu .ds-suggestions{position:relative;z-index:1000;margin-top:8px}.algolia-autocomplete .ds-dropdown-menu .ds-suggestions a:hover{text-decoration:none}.algolia-autocomplete .ds-dropdown-menu .ds-suggestion{cursor:pointer}.algolia-autocomplete .ds-dropdown-menu .ds-suggestion.ds-cursor .algolia-docsearch-suggestion.suggestion-layout-simple,.algolia-autocomplete .ds-dropdown-menu .ds-suggestion.ds-cursor .algolia-docsearch-suggestion:not(.suggestion-layout-simple) .algolia-docsearch-suggestion--content{background-color:rgba(69,142,225,.05)}.algolia-autocomplete .ds-dropdown-menu [class^=ds-dataset-]{position:relative;border:1px solid #d9d9d9;background:#fff;border-radius:4px;overflow:auto;padding:0 8px 8px}.algolia-autocomplete .ds-dropdown-menu *{box-sizing:border-box}.algolia-autocomplete .algolia-docsearch-suggestion{display:block;position:relative;padding:0 8px;background:#fff;color:#02060c;overflow:hidden}.algolia-autocomplete .algolia-docsearch-suggestion--highlight{color:#174d8c;background:rgba(143,187,237,.1);padding:.1em .05em}.algolia-autocomplete .algolia-docsearch-suggestion--category-header .algolia-docsearch-suggestion--category-header-lvl0 .algolia-docsearch-suggestion--highlight,.algolia-autocomplete .algolia-docsearch-suggestion--category-header .algolia-docsearch-suggestion--category-header-lvl1 .algolia-docsearch-suggestion--highlight,.algolia-autocomplete .algolia-docsearch-suggestion--text .algolia-docsearch-suggestion--highlight{padding:0 0 1px;background:inherit;box-shadow:inset 0 -2px 0 0 rgba(69,142,225,.8);color:inherit}.algolia-autocomplete .algolia-docsearch-suggestion--content{display:block;float:right;width:70%;position:relative;padding:5.33333px 0 5.33333px 10.66667px;cursor:pointer}.algolia-autocomplete .algolia-docsearch-suggestion--content:before{content:"";position:absolute;display:block;top:0;height:100%;width:1px;background:#ddd;left:-1px}.algolia-autocomplete .algolia-docsearch-suggestion--category-header{position:relative;border-bottom:1px solid #ddd;display:none;margin-top:8px;padding:4px 0;font-size:1em;color:#33363d}.algolia-autocomplete .algolia-docsearch-suggestion--wrapper{width:100%;float:left;padding:8px 0 0}.algolia-autocomplete .algolia-docsearch-suggestion--subcategory-column{float:left;width:30%;text-align:right;position:relative;padding:5.33333px 10.66667px;color:#a4a7ae;font-size:.9em;word-wrap:break-word}.algolia-autocomplete .algolia-docsearch-suggestion--subcategory-column:before{content:"";position:absolute;display:block;top:0;height:100%;width:1px;background:#ddd;right:0}.algolia-autocomplete .algolia-docsearch-suggestion--subcategory-inline{display:none}.algolia-autocomplete .algolia-docsearch-suggestion--title{margin-bottom:4px;color:#02060c;font-size:.9em;font-weight:700}.algolia-autocomplete .algolia-docsearch-suggestion--text{display:block;line-height:1.2em;font-size:.85em;color:#63676d}.algolia-autocomplete .algolia-docsearch-suggestion--no-results{width:100%;padding:8px 0;text-align:center;font-size:1.2em}.algolia-autocomplete .algolia-docsearch-suggestion--no-results:before{display:none}.algolia-autocomplete .algolia-docsearch-suggestion code{padding:1px 5px;font-size:90%;border:none;color:#222;background-color:#ebebeb;border-radius:3px;font-family:Menlo,Monaco,Consolas,Courier New,monospace}.algolia-autocomplete .algolia-docsearch-suggestion code .algolia-docsearch-suggestion--highlight{background:none}.algolia-autocomplete .algolia-docsearch-suggestion.algolia-docsearch-suggestion__main .algolia-docsearch-suggestion--category-header,.algolia-autocomplete .algolia-docsearch-suggestion.algolia-docsearch-suggestion__secondary{display:block}@media (min-width:768px){.algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--subcategory-column{display:block}}@media (max-width:768px){.algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--subcategory-column{display:inline-block;width:auto;float:left;padding:0;color:#02060c;font-size:.9em;font-weight:700;text-align:left;opacity:.5}.algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--subcategory-column:before{display:none}.algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--subcategory-column:after{content:"|"}.algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--content{display:inline-block;width:auto;text-align:left;float:left;padding:0}.algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--content:before{display:none}}.algolia-autocomplete .suggestion-layout-simple.algolia-docsearch-suggestion{border-bottom:1px solid #eee;padding:8px;margin:0}.algolia-autocomplete .suggestion-layout-simple .algolia-docsearch-suggestion--content{width:100%;padding:0}.algolia-autocomplete .suggestion-layout-simple .algolia-docsearch-suggestion--content:before{display:none}.algolia-autocomplete .suggestion-layout-simple .algolia-docsearch-suggestion--category-header{margin:0;padding:0;display:block;width:100%;border:none}.algolia-autocomplete .suggestion-layout-simple .algolia-docsearch-suggestion--category-header-lvl0,.algolia-autocomplete .suggestion-layout-simple .algolia-docsearch-suggestion--category-header-lvl1{opacity:.6;font-size:.85em}.algolia-autocomplete .suggestion-layout-simple .algolia-docsearch-suggestion--category-header-lvl1:before{background-image:url('data:image/svg+xml;utf8,');content:"";width:10px;height:10px;display:inline-block}.algolia-autocomplete .suggestion-layout-simple .algolia-docsearch-suggestion--wrapper{width:100%;float:left;margin:0;padding:0}.algolia-autocomplete .suggestion-layout-simple .algolia-docsearch-suggestion--duplicate-content,.algolia-autocomplete .suggestion-layout-simple .algolia-docsearch-suggestion--subcategory-inline{display:none!important}.algolia-autocomplete .suggestion-layout-simple .algolia-docsearch-suggestion--title{margin:0;color:#458ee1;font-size:.9em;font-weight:400}.algolia-autocomplete .suggestion-layout-simple .algolia-docsearch-suggestion--title:before{content:"#";font-weight:700;color:#458ee1;display:inline-block}.algolia-autocomplete .suggestion-layout-simple .algolia-docsearch-suggestion--text{margin:4px 0 0;display:block;line-height:1.4em;padding:5.33333px 8px;background:#f8f8f8;font-size:.85em;opacity:.8}.algolia-autocomplete .suggestion-layout-simple .algolia-docsearch-suggestion--text .algolia-docsearch-suggestion--highlight{color:#3f4145;font-weight:700;box-shadow:none}.algolia-autocomplete .algolia-docsearch-footer{width:134px;height:20px;z-index:2000;margin-top:10.66667px;float:right;font-size:0;line-height:0}.algolia-autocomplete .algolia-docsearch-footer--logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='168' height='24' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cpath d='M78.988.938h16.594a2.968 2.968 0 012.966 2.966V20.5a2.967 2.967 0 01-2.966 2.964H78.988a2.967 2.967 0 01-2.966-2.964V3.897A2.961 2.961 0 0178.988.938zm41.937 17.866c-4.386.02-4.386-3.54-4.386-4.106l-.007-13.336 2.675-.424v13.254c0 .322 0 2.358 1.718 2.364v2.248zm-10.846-2.18c.821 0 1.43-.047 1.855-.129v-2.719a6.334 6.334 0 00-1.574-.199 5.7 5.7 0 00-.897.069 2.699 2.699 0 00-.814.24c-.24.116-.439.28-.582.491-.15.212-.219.335-.219.656 0 .628.219.991.616 1.23s.938.362 1.615.362zm-.233-9.7c.883 0 1.629.109 2.231.328.602.218 1.088.525 1.444.915.363.396.609.922.76 1.483.157.56.232 1.175.232 1.85v6.874a32.5 32.5 0 01-1.868.314c-.834.123-1.772.185-2.813.185-.69 0-1.327-.069-1.895-.198a4.001 4.001 0 01-1.471-.636 3.085 3.085 0 01-.951-1.134c-.226-.465-.343-1.12-.343-1.803 0-.656.13-1.073.384-1.525a3.24 3.24 0 011.047-1.106c.445-.287.95-.492 1.532-.615a8.8 8.8 0 011.82-.185 8.404 8.404 0 011.972.24v-.438c0-.307-.035-.6-.11-.874a1.88 1.88 0 00-.384-.73 1.784 1.784 0 00-.724-.493 3.164 3.164 0 00-1.143-.205c-.616 0-1.177.075-1.69.164a7.735 7.735 0 00-1.26.307l-.321-2.192c.335-.117.834-.233 1.478-.349a10.98 10.98 0 012.073-.178zm52.842 9.626c.822 0 1.43-.048 1.854-.13V13.7a6.347 6.347 0 00-1.574-.199c-.294 0-.595.021-.896.069a2.7 2.7 0 00-.814.24 1.46 1.46 0 00-.582.491c-.15.212-.218.335-.218.656 0 .628.218.991.615 1.23.404.245.938.362 1.615.362zm-.226-9.694c.883 0 1.629.108 2.231.327.602.219 1.088.526 1.444.915.355.39.609.923.759 1.483a6.8 6.8 0 01.233 1.852v6.873c-.41.088-1.034.19-1.868.314-.834.123-1.772.184-2.813.184-.69 0-1.327-.068-1.895-.198a4.001 4.001 0 01-1.471-.635 3.085 3.085 0 01-.951-1.134c-.226-.465-.343-1.12-.343-1.804 0-.656.13-1.073.384-1.524.26-.45.608-.82 1.047-1.107.445-.286.95-.491 1.532-.614a8.803 8.803 0 012.751-.13c.329.034.671.096 1.04.185v-.437a3.3 3.3 0 00-.109-.875 1.873 1.873 0 00-.384-.731 1.784 1.784 0 00-.724-.492 3.165 3.165 0 00-1.143-.205c-.616 0-1.177.075-1.69.164a7.75 7.75 0 00-1.26.307l-.321-2.193c.335-.116.834-.232 1.478-.348a11.633 11.633 0 012.073-.177zm-8.034-1.271a1.626 1.626 0 01-1.628-1.62c0-.895.725-1.62 1.628-1.62.904 0 1.63.725 1.63 1.62 0 .895-.733 1.62-1.63 1.62zm1.348 13.22h-2.689V7.27l2.69-.423v11.956zm-4.714 0c-4.386.02-4.386-3.54-4.386-4.107l-.008-13.336 2.676-.424v13.254c0 .322 0 2.358 1.718 2.364v2.248zm-8.698-5.903c0-1.156-.253-2.119-.746-2.788-.493-.677-1.183-1.01-2.067-1.01-.882 0-1.574.333-2.065 1.01-.493.676-.733 1.632-.733 2.788 0 1.168.246 1.953.74 2.63.492.683 1.183 1.018 2.066 1.018.882 0 1.574-.342 2.067-1.019.492-.683.738-1.46.738-2.63zm2.737-.007c0 .902-.13 1.584-.397 2.33a5.52 5.52 0 01-1.128 1.906 4.986 4.986 0 01-1.752 1.223c-.685.286-1.739.45-2.265.45-.528-.006-1.574-.157-2.252-.45a5.096 5.096 0 01-1.744-1.223c-.487-.527-.863-1.162-1.137-1.906a6.345 6.345 0 01-.41-2.33c0-.902.123-1.77.397-2.508a5.554 5.554 0 011.15-1.892 5.133 5.133 0 011.75-1.216c.679-.287 1.425-.423 2.232-.423.808 0 1.553.142 2.237.423a4.88 4.88 0 011.753 1.216 5.644 5.644 0 011.135 1.892c.287.738.431 1.606.431 2.508zm-20.138 0c0 1.12.246 2.363.738 2.882.493.52 1.13.78 1.91.78.424 0 .828-.062 1.204-.178.377-.116.677-.253.917-.417V9.33a10.476 10.476 0 00-1.766-.226c-.971-.028-1.71.37-2.23 1.004-.513.636-.773 1.75-.773 2.788zm7.438 5.274c0 1.824-.466 3.156-1.404 4.004-.936.846-2.367 1.27-4.296 1.27-.705 0-2.17-.137-3.34-.396l.431-2.118c.98.205 2.272.26 2.95.26 1.074 0 1.84-.219 2.299-.656.459-.437.684-1.086.684-1.948v-.437a8.07 8.07 0 01-1.047.397c-.43.13-.93.198-1.492.198-.739 0-1.41-.116-2.018-.349a4.206 4.206 0 01-1.567-1.025c-.431-.45-.774-1.017-1.013-1.694-.24-.677-.363-1.885-.363-2.773 0-.834.13-1.88.384-2.577.26-.696.629-1.298 1.129-1.796.493-.498 1.095-.881 1.8-1.162a6.605 6.605 0 012.428-.457c.87 0 1.67.109 2.45.24.78.129 1.444.265 1.985.415V18.17z' fill='%235468FF'/%3E%3Cpath d='M6.972 6.677v1.627c-.712-.446-1.52-.67-2.425-.67-.585 0-1.045.13-1.38.391a1.24 1.24 0 00-.502 1.03c0 .425.164.765.494 1.02.33.256.835.532 1.516.83.447.192.795.356 1.045.495.25.138.537.332.862.582.324.25.563.548.718.894.154.345.23.741.23 1.188 0 .947-.334 1.691-1.004 2.234-.67.542-1.537.814-2.601.814-1.18 0-2.16-.229-2.936-.686v-1.708c.84.628 1.814.942 2.92.942.585 0 1.048-.136 1.388-.407.34-.271.51-.646.51-1.125 0-.287-.1-.55-.302-.79-.203-.24-.42-.42-.655-.542-.234-.123-.585-.29-1.053-.503a61.27 61.27 0 01-.582-.271 13.67 13.67 0 01-.55-.287 4.275 4.275 0 01-.567-.351 6.92 6.92 0 01-.455-.4c-.18-.17-.31-.34-.39-.51-.08-.17-.155-.37-.224-.598a2.553 2.553 0 01-.104-.742c0-.915.333-1.638.998-2.17.664-.532 1.523-.798 2.576-.798.968 0 1.793.17 2.473.51zm7.468 5.696v-.287c-.022-.607-.187-1.088-.495-1.444-.309-.357-.75-.535-1.324-.535-.532 0-.99.194-1.373.583-.382.388-.622.949-.717 1.683h3.909zm1.005 2.792v1.404c-.596.34-1.383.51-2.362.51-1.255 0-2.255-.377-3-1.132-.744-.755-1.116-1.744-1.116-2.968 0-1.297.34-2.316 1.021-3.055.68-.74 1.548-1.11 2.6-1.11 1.033 0 1.852.323 2.458.966.606.644.91 1.572.91 2.784 0 .33-.033.676-.096 1.038h-5.314c.107.702.405 1.239.894 1.611.49.372 1.106.558 1.85.558.862 0 1.58-.202 2.155-.606zm6.605-1.77h-1.212c-.596 0-1.045.116-1.349.35-.303.234-.454.532-.454.894 0 .372.117.664.35.877.235.213.575.32 1.022.32.51 0 .912-.142 1.204-.424.293-.281.44-.651.44-1.108v-.91zm-4.068-2.554V9.325c.627-.361 1.457-.542 2.489-.542 2.116 0 3.175 1.026 3.175 3.08V17h-1.548v-.957c-.415.68-1.143 1.02-2.186 1.02-.766 0-1.38-.22-1.843-.661-.462-.442-.694-1.003-.694-1.684 0-.776.293-1.38.878-1.81.585-.431 1.404-.647 2.457-.647h1.34V11.8c0-.554-.133-.971-.399-1.253-.266-.282-.707-.423-1.324-.423a4.07 4.07 0 00-2.345.718zm9.333-1.93v1.42c.394-1 1.101-1.5 2.123-1.5.148 0 .313.016.494.048v1.531a1.885 1.885 0 00-.75-.143c-.542 0-.989.24-1.34.718-.351.479-.527 1.048-.527 1.707V17h-1.563V8.91h1.563zm5.01 4.084c.022.82.272 1.492.75 2.019.479.526 1.15.79 2.01.79.639 0 1.235-.176 1.788-.527v1.404c-.521.319-1.186.479-1.995.479-1.265 0-2.276-.4-3.031-1.197-.755-.798-1.133-1.792-1.133-2.984 0-1.16.38-2.151 1.14-2.975.761-.825 1.79-1.237 3.088-1.237.702 0 1.346.149 1.93.447v1.436a3.242 3.242 0 00-1.77-.495c-.84 0-1.513.266-2.019.798-.505.532-.758 1.213-.758 2.042zM40.24 5.72v4.579c.458-1 1.293-1.5 2.505-1.5.787 0 1.42.245 1.899.734.479.49.718 1.17.718 2.042V17h-1.564v-5.106c0-.553-.14-.98-.422-1.284-.282-.303-.652-.455-1.11-.455-.531 0-1.002.202-1.411.606-.41.405-.615 1.022-.615 1.851V17h-1.563V5.72h1.563zm14.966 10.02c.596 0 1.096-.253 1.5-.758.404-.506.606-1.157.606-1.955 0-.915-.202-1.62-.606-2.114-.404-.495-.92-.742-1.548-.742-.553 0-1.05.224-1.491.67-.442.447-.662 1.133-.662 2.058 0 .958.212 1.67.638 2.138.425.469.946.703 1.563.703zM53.004 5.72v4.42c.574-.894 1.388-1.341 2.44-1.341 1.022 0 1.857.383 2.506 1.149.649.766.973 1.781.973 3.047 0 1.138-.309 2.109-.925 2.912-.617.803-1.463 1.205-2.537 1.205-1.075 0-1.894-.447-2.457-1.34V17h-1.58V5.72h1.58zm9.908 11.104l-3.223-7.913h1.739l1.005 2.632 1.26 3.415c.096-.32.48-1.458 1.15-3.415l.909-2.632h1.66l-2.92 7.866c-.777 2.074-1.963 3.11-3.559 3.11a2.92 2.92 0 01-.734-.079v-1.34c.17.042.351.064.543.064 1.032 0 1.755-.57 2.17-1.708z' fill='%235D6494'/%3E%3Cpath d='M89.632 5.967v-.772a.978.978 0 00-.978-.977h-2.28a.978.978 0 00-.978.977v.793c0 .088.082.15.171.13a7.127 7.127 0 011.984-.28c.65 0 1.295.088 1.917.259.082.02.164-.04.164-.13m-6.248 1.01l-.39-.389a.977.977 0 00-1.382 0l-.465.465a.973.973 0 000 1.38l.383.383c.062.061.15.047.205-.014.226-.307.472-.601.746-.874.281-.28.568-.526.883-.751.068-.042.075-.137.02-.2m4.16 2.453v3.341c0 .096.104.165.192.117l2.97-1.537c.068-.034.089-.117.055-.184a3.695 3.695 0 00-3.08-1.866c-.068 0-.136.054-.136.13m0 8.048a4.489 4.489 0 01-4.49-4.482 4.488 4.488 0 014.49-4.482 4.488 4.488 0 014.489 4.482 4.484 4.484 0 01-4.49 4.482m0-10.85a6.363 6.363 0 100 12.729 6.37 6.37 0 006.372-6.368 6.358 6.358 0 00-6.371-6.36' fill='%23FFF'/%3E%3C/g%3E%3C/svg%3E");background-repeat:no-repeat;background-position:50%;background-size:100%;overflow:hidden;text-indent:-9000px;padding:0!important;width:100%;height:100%;display:block}
\ No newline at end of file
diff --git a/assets/img/search.83621669.svg b/assets/img/search.83621669.svg
new file mode 100644
index 000000000..03d83913e
--- /dev/null
+++ b/assets/img/search.83621669.svg
@@ -0,0 +1 @@
+
diff --git a/assets/js/10.b593aa85.js b/assets/js/10.b593aa85.js
new file mode 100644
index 000000000..ac9fd116a
--- /dev/null
+++ b/assets/js/10.b593aa85.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[10],{175:function(t,e,a){},208:function(t,e,a){"use strict";a(175)},221:function(t,e,a){"use strict";a.r(e);var s={name:"CodeBlock",props:{title:{type:String,required:!0},active:{type:Boolean,default:!1}},mounted(){this.$parent&&this.$parent.loadTabs&&this.$parent.loadTabs()}},i=(a(208),a(6)),n=Object(i.a)(s,(function(){var t=this.$createElement;return(this._self._c||t)("div",{staticClass:"theme-code-block",class:{"theme-code-block__active":this.active}},[this._t("default")],2)}),[],!1,null,"759a7d02",null);e.default=n.exports}}]);
\ No newline at end of file
diff --git a/assets/js/11.e70694b8.js b/assets/js/11.e70694b8.js
new file mode 100644
index 000000000..035a34309
--- /dev/null
+++ b/assets/js/11.e70694b8.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[11],{176:function(e,t,a){},209:function(e,t,a){"use strict";a(176)},222:function(e,t,a){"use strict";a.r(t);var o={name:"CodeGroup",data:()=>({codeTabs:[],activeCodeTabIndex:-1}),watch:{activeCodeTabIndex(e){this.activateCodeTab(e)}},mounted(){this.loadTabs()},methods:{changeCodeTab(e){this.activeCodeTabIndex=e},loadTabs(){this.codeTabs=(this.$slots.default||[]).filter(e=>Boolean(e.componentOptions)).map((e,t)=>(""===e.componentOptions.propsData.active&&(this.activeCodeTabIndex=t),{title:e.componentOptions.propsData.title,elm:e.elm})),-1===this.activeCodeTabIndex&&this.codeTabs.length>0&&(this.activeCodeTabIndex=0),this.activateCodeTab(0)},activateCodeTab(e){this.codeTabs.forEach(e=>{e.elm&&e.elm.classList.remove("theme-code-block__active")}),this.codeTabs[e].elm&&this.codeTabs[e].elm.classList.add("theme-code-block__active")}}},s=(a(209),a(6)),c=Object(s.a)(o,(function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("ClientOnly",[a("div",{staticClass:"theme-code-group"},[a("div",{staticClass:"theme-code-group__nav"},[a("ul",{staticClass:"theme-code-group__ul"},e._l(e.codeTabs,(function(t,o){return a("li",{key:t.title,staticClass:"theme-code-group__li"},[a("button",{staticClass:"theme-code-group__nav-tab",class:{"theme-code-group__nav-tab-active":o===e.activeCodeTabIndex},on:{click:function(t){return e.changeCodeTab(o)}}},[e._v("\n "+e._s(t.title)+"\n ")])])})),0)]),e._v(" "),e._t("default"),e._v(" "),e.codeTabs.length<1?a("pre",{staticClass:"pre-blank"},[e._v("// Make sure to add code blocks to your code group")]):e._e()],2)])}),[],!1,null,"deefee04",null);t.default=c.exports}}]);
\ No newline at end of file
diff --git a/assets/js/12.eac7b90f.js b/assets/js/12.eac7b90f.js
new file mode 100644
index 000000000..69922ea8c
--- /dev/null
+++ b/assets/js/12.eac7b90f.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[12],{170:function(t,e,s){},199:function(t,e,s){"use strict";s(170)},217:function(t,e,s){"use strict";s.r(e);var n={name:"Community",data(){return{members:this.members||[]}},mounted(){fetch("https://green-sun-f03e.encors.workers.dev/?url="+encodeURIComponent("https://discordapp.com/api/guilds/721472913886281818/widget.json"),{mode:"cors",credentials:"omit"}).then(t=>t.json()).then(({members:t})=>{this.members=t.filter(t=>"string"==typeof t.username&&"string"==typeof t.avatar_url&&t.avatar_url.startsWith("https://cdn.discordapp.com/")&&["online","idle","dnd"].includes(t.status))}).catch(t=>{})}},r=(s(199),s(6)),a=Object(r.a)(n,(function(){var t=this.$createElement,e=this._self._c||t;return this.members.length>0?e("div",{staticClass:"community"},[e("div",{staticClass:"list"},this._l(this.members,(function(t){return e("a",{class:t.status,attrs:{href:"https://discord.gg/assemblyscript",title:t.username,target:"_blank",rel:"noopener"}},[e("img",{attrs:{src:t.avatar_url+"?size=64",alt:t.username,loading:"lazy"}})])})),0)]):this._e()}),[],!1,null,"181c7660",null);e.default=a.exports}}]);
\ No newline at end of file
diff --git a/assets/js/13.a23bc4f4.js b/assets/js/13.a23bc4f4.js
new file mode 100644
index 000000000..8aaf08eac
--- /dev/null
+++ b/assets/js/13.a23bc4f4.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[13],{215:function(t,e,s){"use strict";s.r(e);const o=["There's nothing here.","How did we get here?","That's a Four-Oh-Four.","Looks like we've got some broken links."];var n={methods:{getMsg:()=>o[Math.floor(Math.random()*o.length)]}},h=s(6),i=Object(h.a)(n,(function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"theme-container"},[e("div",{staticClass:"theme-default-content"},[e("h1",[this._v("404")]),this._v(" "),e("blockquote",[this._v(this._s(this.getMsg()))]),this._v(" "),e("RouterLink",{attrs:{to:"/"}},[this._v("\n Take me home.\n ")])],1)])}),[],!1,null,null,null);e.default=i.exports}}]);
\ No newline at end of file
diff --git a/assets/js/14.38407d5c.js b/assets/js/14.38407d5c.js
new file mode 100644
index 000000000..5a0526468
--- /dev/null
+++ b/assets/js/14.38407d5c.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[14],{259:function(t,e,s){"use strict";s.r(e);var n=s(6),i=Object(n.a)({},(function(){var t=this.$createElement;return(this._self._c||t)("img",{staticClass:"engine",attrs:{src:"/images/chrome.svg",width:"18",height:"18",title:"Chrome"}})}),[],!1,null,null,null);e.default=i.exports}}]);
\ No newline at end of file
diff --git a/assets/js/15.ccfb67c4.js b/assets/js/15.ccfb67c4.js
new file mode 100644
index 000000000..1d437a08c
--- /dev/null
+++ b/assets/js/15.ccfb67c4.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[15],{261:function(t,e,i){"use strict";i.r(e);var s=i(6),n=Object(s.a)({},(function(){var t=this.$createElement;return(this._self._c||t)("img",{staticClass:"engine",attrs:{src:"/images/firefox.svg",width:"18",height:"18",title:"Firefox"}})}),[],!1,null,null,null);e.default=n.exports}}]);
\ No newline at end of file
diff --git a/assets/js/16.9e12fbb3.js b/assets/js/16.9e12fbb3.js
new file mode 100644
index 000000000..a6830bc33
--- /dev/null
+++ b/assets/js/16.9e12fbb3.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[16],{260:function(t,e,s){"use strict";s.r(e);var n=s(6),i=Object(n.a)({},(function(){var t=this.$createElement;return(this._self._c||t)("img",{staticClass:"engine",attrs:{src:"/images/nodejs.svg",width:"18",height:"18",title:"Node.js"}})}),[],!1,null,null,null);e.default=i.exports}}]);
\ No newline at end of file
diff --git a/assets/js/17.ebe32f37.js b/assets/js/17.ebe32f37.js
new file mode 100644
index 000000000..5758879f9
--- /dev/null
+++ b/assets/js/17.ebe32f37.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[17],{262:function(t,e,s){"use strict";s.r(e);var i=s(6),a=Object(i.a)({},(function(){var t=this.$createElement;return(this._self._c||t)("img",{staticClass:"engine",attrs:{src:"/images/safari.svg",width:"18",height:"18",title:"Safari"}})}),[],!1,null,null,null);e.default=a.exports}}]);
\ No newline at end of file
diff --git a/assets/js/18.e8b2f77f.js b/assets/js/18.e8b2f77f.js
new file mode 100644
index 000000000..91ac35eaa
--- /dev/null
+++ b/assets/js/18.e8b2f77f.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[18],{263:function(t,e,s){"use strict";s.r(e);var n=s(6),i=Object(n.a)({},(function(){var t=this.$createElement;return(this._self._c||t)("img",{staticClass:"engine",attrs:{src:"/images/wasmer.svg",width:"18",height:"18",title:"Wasmer"}})}),[],!1,null,null,null);e.default=i.exports}}]);
\ No newline at end of file
diff --git a/assets/js/19.70bbb3ef.js b/assets/js/19.70bbb3ef.js
new file mode 100644
index 000000000..00abcf750
--- /dev/null
+++ b/assets/js/19.70bbb3ef.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[19],{264:function(t,e,n){"use strict";n.r(e);var i=n(6),s=Object(i.a)({},(function(){var t=this.$createElement;return(this._self._c||t)("img",{staticClass:"engine",attrs:{src:"/images/noimage.png",width:"18",height:"18",title:"Wasmtime"}})}),[],!1,null,null,null);e.default=s.exports}}]);
\ No newline at end of file
diff --git a/assets/js/20.10384fec.js b/assets/js/20.10384fec.js
new file mode 100644
index 000000000..1057475b7
--- /dev/null
+++ b/assets/js/20.10384fec.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[20],{265:function(t,n,e){"use strict";e.r(n);var i=e(6),l=Object(i.a)({},(function(){var t=this.$createElement;return(this._self._c||t)("span",{staticStyle:{display:"inline-block",width:"18px",height:"18px"}})}),[],!1,null,null,null);n.default=l.exports}}]);
\ No newline at end of file
diff --git a/assets/js/21.0ad30828.js b/assets/js/21.0ad30828.js
new file mode 100644
index 000000000..03c85fefe
--- /dev/null
+++ b/assets/js/21.0ad30828.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[21],{223:function(r,e,t){"use strict";t.r(e);var a=t(6),n=Object(a.a)({},(function(){var r=this,e=r.$createElement,t=r._self._c||e;return t("ContentSlotsDistributor",{attrs:{"slot-key":r.$parent.slotKey}},[t("h1",{attrs:{id:"built-with-assemblyscript"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#built-with-assemblyscript"}},[r._v("#")]),r._v(" Built with AssemblyScript")]),r._v(" "),t("p",[r._v("A place for all things AssemblyScript. Feel free to add your projects and applications.")]),r._v(" "),t("h2",{attrs:{id:"benchmarks"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#benchmarks"}},[r._v("#")]),r._v(" Benchmarks")]),r._v(" "),t("ul",[t("li",[t("a",{attrs:{href:"https://github.com/jtiscione/webassembly-wave",target:"_blank",rel:"noopener noreferrer"}},[r._v("webassembly-wave"),t("OutboundLink")],1),r._v(" ("),t("a",{attrs:{href:"https://jtiscione.github.io/webassembly-wave/index.html",target:"_blank",rel:"noopener noreferrer"}},[r._v("demo"),t("OutboundLink")],1),r._v(")"),t("br"),r._v("\nJavaScript vs WebAssembly performance comparison - wave equation demo (JS, C++, AssemblyScript).")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/t-katsumura/webassembly-examples-eratosthenes",target:"_blank",rel:"noopener noreferrer"}},[r._v("Eratosthenes"),t("OutboundLink")],1),t("br"),r._v("\nWebAssembly examples which calculate prime by Sieve of Eratosthenes.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://wasmboy.app/benchmark/",target:"_blank",rel:"noopener noreferrer"}},[r._v("WasmBoy Benchmark"),t("OutboundLink")],1),t("br"),r._v("\nBenchmarking WasmBoy emulator.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/w8r/wasm-n-body",target:"_blank",rel:"noopener noreferrer"}},[r._v("wasm-n-body"),t("OutboundLink")],1),t("br"),r._v("\nWebAssembly N-body simulation benchmark "),t("em",[r._v("(use 1000 bodies compare to original).")])]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/nischayv/as-benchmarks",target:"_blank",rel:"noopener noreferrer"}},[r._v("as-benchmarks"),t("OutboundLink")],1),r._v(" ("),t("a",{attrs:{href:"https://nischayv.github.io/as-benchmarks/index.html",target:"_blank",rel:"noopener noreferrer"}},[r._v("demo"),t("OutboundLink")],1),r._v(")"),t("br"),r._v("\nA set of computational benchmarks (JS, AssemblyScript).")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/manueldois/WebAssembly/tree/master/Sort%20Colors%20Benchmark/src",target:"_blank",rel:"noopener noreferrer"}},[r._v("Sort Colors Benchmark"),t("OutboundLink")],1),r._v(" ("),t("a",{attrs:{href:"https://manueldois.github.io/WebAssembly/Sort%20Colors%20Benchmark/dist/index.html",target:"_blank",rel:"noopener noreferrer"}},[r._v("demo"),t("OutboundLink")],1),r._v(")"),t("br"),r._v("\nBench of sorting random colors by hue component on 2d canvas.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/ColinEberhardt/wasm-mandelbrot",target:"_blank",rel:"noopener noreferrer"}},[r._v("Wasm Mandelbrot"),t("OutboundLink")],1),r._v(" ("),t("a",{attrs:{href:"https://colineberhardt.github.io/wasm-mandelbrot/#AssemblyScript",target:"_blank",rel:"noopener noreferrer"}},[r._v("demo"),t("OutboundLink")],1),r._v(")"),t("br"),r._v("\nA mandelbrot rendered using a variety of WebAssembly tools (emscripten, AssemblyScript, asm.js, etc ...)")])]),r._v(" "),t("h2",{attrs:{id:"blockchain"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#blockchain"}},[r._v("#")]),r._v(" Blockchain")]),r._v(" "),t("ul",[t("li",[t("a",{attrs:{href:"https://github.com/ascontract/subscript",target:"_blank",rel:"noopener noreferrer"}},[r._v("ASContract / subscript"),t("OutboundLink")],1),t("br"),r._v("\nSubstrate smart contract framework written in AssemblyScript.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/ewasm/biturbo",target:"_blank",rel:"noopener noreferrer"}},[r._v("eWasm / Biturbo"),t("OutboundLink")],1),t("br"),r._v("\nEth1 EE using Turboproofs.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/ewasm/scout.ts",target:"_blank",rel:"noopener noreferrer"}},[r._v("ewasm / scout.ts "),t("OutboundLink")],1),t("br"),r._v("\nScout is a Ethereum 2.0 Phase 2 execution prototyping engine (AssemblyScript Port).")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/near/near-sdk-as",target:"_blank",rel:"noopener noreferrer"}},[r._v("NearProtocol / near-sdk-as"),t("OutboundLink")],1),t("br"),r._v("\nAssemblyScript tools for writing smart contracts for NearProtocol.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/graphprotocol/graph-ts",target:"_blank",rel:"noopener noreferrer"}},[r._v("GraphProtocol / graph-ts"),t("OutboundLink")],1),t("br"),r._v("\nTypeScript/AssemblyScript library for writing mappings for "),t("a",{attrs:{href:"https://thegraph.com",target:"_blank",rel:"noopener noreferrer"}},[r._v("The Graph"),t("OutboundLink")],1),r._v(".")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/ChainSafe/as-sha256",target:"_blank",rel:"noopener noreferrer"}},[r._v("ChainSafe / as-sha256"),t("OutboundLink")],1),t("br"),r._v("\nAssemblyScript implementation of SHA256 for "),t("a",{attrs:{href:"https://github.com/ChainSafe/lodestar",target:"_blank",rel:"noopener noreferrer"}},[r._v("Lodestar"),t("OutboundLink")],1),r._v(".")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/paritytech/srml-contracts-waterfall",target:"_blank",rel:"noopener noreferrer"}},[r._v("ParityTech / srml-contracts-waterfall"),t("OutboundLink")],1),t("br"),r._v("\nCollection of simple Substrate smart contract examples written in Rust and AssemblyScript and tests for Substrates SRML Contracts module.")])]),r._v(" "),t("h2",{attrs:{id:"build-tools"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#build-tools"}},[r._v("#")]),r._v(" Build Tools")]),r._v(" "),t("ul",[t("li",[t("a",{attrs:{href:"https://github.com/lastmjs/zwitterion",target:"_blank",rel:"noopener noreferrer"}},[r._v("Zwitterion"),t("OutboundLink")],1),t("br"),r._v("\nA web dev server that lets you import anything*.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/surma/rollup-plugin-assemblyscript",target:"_blank",rel:"noopener noreferrer"}},[r._v("rollup-plugin-assemblyscript"),t("OutboundLink")],1),t("br"),r._v("\nA Rollup plugin that allows you to import AssemblyScript files and compiles them on-the-fly.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/piotr-oles/as-loader",target:"_blank",rel:"noopener noreferrer"}},[r._v("as-loader"),t("OutboundLink")],1),t("br"),r._v("\nA webpack loader for AssemblyScript")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/willemneal/visitor-as",target:"_blank",rel:"noopener noreferrer"}},[r._v("visitor-as"),t("OutboundLink")],1),t("br"),r._v("\nTools for creating compiler transformers.")])]),r._v(" "),t("h2",{attrs:{id:"demoscene"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#demoscene"}},[r._v("#")]),r._v(" Demoscene")]),r._v(" "),t("ul",[t("li",[t("a",{attrs:{href:"https://wasm-demo.codument.com",target:"_blank",rel:"noopener noreferrer"}},[r._v("Hoofdkantoor WASM Demo"),t("OutboundLink")],1),t("br"),r._v("\nA demo built with AssemblyScript (also TS and Web Audio API). It's an homage to the old school Demoscene of the early 90s.")])]),r._v(" "),t("h2",{attrs:{id:"editors"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#editors"}},[r._v("#")]),r._v(" Editors")]),r._v(" "),t("ul",[t("li",[t("a",{attrs:{href:"https://wasm.fastlylabs.com/",target:"_blank",rel:"noopener noreferrer"}},[r._v("Fastly Terrarium"),t("OutboundLink")],1),t("br"),r._v("\nA compilation toolchain and sandbox to run WebAssembly server-side, with native support for AssemblyScript.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://examples.near.org/",target:"_blank",rel:"noopener noreferrer"}},[r._v("NEAR Protocol Examples"),t("OutboundLink")],1),t("br"),r._v("\nExamples that use "),t("a",{attrs:{href:"https://gitpod.io/",target:"_blank",rel:"noopener noreferrer"}},[r._v("GitPod"),t("OutboundLink")],1),r._v(" to develop and deploy distributed web apps using NEAR smart contracts authored in AssemblyScript.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://alpha.iodide.io/notebooks/1234",target:"_blank",rel:"noopener noreferrer"}},[r._v("Iodide Notebook"),t("OutboundLink")],1),t("br"),r._v("\nExperimental tool for scientific communication and exploration on the web ("),t("a",{attrs:{href:"https://hacks.mozilla.org/2019/03/iodide-an-experimental-tool-for-scientific-communicatiodide-for-scientific-communication-exploration-on-the-web",target:"_blank",rel:"noopener noreferrer"}},[r._v("more"),t("OutboundLink")],1),r._v(").")])]),r._v(" "),t("h2",{attrs:{id:"formatter"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#formatter"}},[r._v("#")]),r._v(" Formatter")]),r._v(" "),t("ul",[t("li",[t("a",{attrs:{href:"https://github.com/HerrCai0907/assemblyscript-prettier",target:"_blank",rel:"noopener noreferrer"}},[r._v("assemblyscript-prettier"),t("OutboundLink")],1),t("br"),r._v("\nPrettier plugin for assemblyscript to resolve the incompatible part of ts and as syntax")])]),r._v(" "),t("h2",{attrs:{id:"emulators"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#emulators"}},[r._v("#")]),r._v(" Emulators")]),r._v(" "),t("ul",[t("li",[t("a",{attrs:{href:"https://github.com/torch2424/wasmBoy",target:"_blank",rel:"noopener noreferrer"}},[r._v("wasmBoy"),t("OutboundLink")],1),r._v(" ("),t("a",{attrs:{href:"https://wasmboy.app/",target:"_blank",rel:"noopener noreferrer"}},[r._v("demo"),t("OutboundLink")],1),r._v(")"),t("br"),r._v("\nGame Boy / Game Boy Color Emulator Library, written for WebAssembly using AssemblyScript.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/ColinEberhardt/atari2600-wasm",target:"_blank",rel:"noopener noreferrer"}},[r._v("Atari 2600"),t("OutboundLink")],1),t("br"),r._v("\nAn Atari 2600 emulator written in AssemblyScript compiled to WebAssembly.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/Dotneteer/as-spectrum-engine",target:"_blank",rel:"noopener noreferrer"}},[r._v("as-spectrum-engine"),t("OutboundLink")],1),t("br"),r._v("\nAssemblyScript implementation of a ZX Spectrum emulator engine.")])]),r._v(" "),t("h2",{attrs:{id:"games"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#games"}},[r._v("#")]),r._v(" Games")]),r._v(" "),t("ul",[t("li",[t("a",{attrs:{href:"https://github.com/mhonert/chess",target:"_blank",rel:"noopener noreferrer"}},[r._v("Chess"),t("OutboundLink")],1),r._v(" ("),t("a",{attrs:{href:"https://mhonert.github.io/chess",target:"_blank",rel:"noopener noreferrer"}},[r._v("play"),t("OutboundLink")],1),r._v(")"),t("br"),r._v("\nA free and open source chess game using AssemblyScript and React.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/jolestar/gomoku-wasm",target:"_blank",rel:"noopener noreferrer"}},[r._v("Gomoku WASM"),t("OutboundLink")],1),r._v(" ("),t("a",{attrs:{href:"http://jolestar.com/gomoku-wasm",target:"_blank",rel:"noopener noreferrer"}},[r._v("play"),t("OutboundLink")],1),r._v(")"),t("br"),r._v("\nA Gomoku game implements with WebAssembly using "),t("a",{attrs:{href:"https://github.com/as2d/as2d",target:"_blank",rel:"noopener noreferrer"}},[r._v("as2d"),t("OutboundLink")],1),r._v(".")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/ttulka/2d-videogame-in-assemblyscript",target:"_blank",rel:"noopener noreferrer"}},[r._v("2d-videogame-in-assemblyscript"),t("OutboundLink")],1),t("br"),r._v("\nDemo 2D videogame in AssemblyScript.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/ameliabradley/fiberoptic-game",target:"_blank",rel:"noopener noreferrer"}},[r._v("fiberoptic-game"),t("OutboundLink")],1),t("br"),r._v("\nWeb game produced with AssemblyScript for js13k 2018.")])]),r._v(" "),t("h2",{attrs:{id:"graphics-game-frameworks"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#graphics-game-frameworks"}},[r._v("#")]),r._v(" Graphics / Game Frameworks")]),r._v(" "),t("ul",[t("li",[t("a",{attrs:{href:"https://github.com/as2d/as2d",target:"_blank",rel:"noopener noreferrer"}},[r._v("as2d"),t("OutboundLink")],1),t("br"),r._v("\n["),t("em",[r._v("Deprecated")]),r._v("] Bring the power of the CanvasRenderingContext2D prototype to AssemblyScript.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/mrchantey/koora",target:"_blank",rel:"noopener noreferrer"}},[r._v("koora"),t("OutboundLink")],1),t("br"),r._v("\nAssemblyscript 3D Game Framework.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/01alchemist/as-smallpt",target:"_blank",rel:"noopener noreferrer"}},[r._v("as-smallpt"),t("OutboundLink")],1),t("br"),r._v("\nPort of C++ smallpt, a path tracing renderer.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/ycw/Babylon.Font",target:"_blank",rel:"noopener noreferrer"}},[r._v("Babylon.Font"),t("OutboundLink")],1),t("br"),r._v("\nCreate 3d text in BabylonJS.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/Tugcga/Path-Finder/tree/main/assemblyscript",target:"_blank",rel:"noopener noreferrer"}},[r._v("Path-Finder"),t("OutboundLink")],1),t("br"),r._v("\nAssemblyScript NavMesh Path Finder.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/alexvictoor/seam-carving-as",target:"_blank",rel:"noopener noreferrer"}},[r._v("seam-carving-as"),t("OutboundLink")],1),t("br"),r._v("\nSeam Carving experiments with AssemblyScript.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/battlelinegames/ASWebGLue",target:"_blank",rel:"noopener noreferrer"}},[r._v("ASWebGLue"),t("OutboundLink")],1),t("br"),r._v("\nWebGL bindings for AssemblyScript.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/lume/glas",target:"_blank",rel:"noopener noreferrer"}},[r._v("GLAS"),t("OutboundLink")],1),t("br"),r._v("\nWeb"),t("strong",[r._v("GL")]),r._v(" in "),t("strong",[r._v("A")]),r._v("ssembly"),t("strong",[r._v("S")]),r._v("cript, port of "),t("a",{attrs:{href:"https://github.com/mrdoob/three.js/",target:"_blank",rel:"noopener noreferrer"}},[r._v("Three.js"),t("OutboundLink")],1),r._v(" to AssemblyScript.")])]),r._v(" "),t("h2",{attrs:{id:"data-serialization-deserialization"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#data-serialization-deserialization"}},[r._v("#")]),r._v(" Data Serialization / Deserialization")]),r._v(" "),t("ul",[t("li",[t("a",{attrs:{href:"https://github.com/inkeliz/karmem",target:"_blank",rel:"noopener noreferrer"}},[r._v("karmem"),t("OutboundLink")],1),t("br"),r._v("\nKarmem is a fast binary serialization format, faster than Google Flatbuffers and optimized for WebAssembly languages.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/piotr-oles/as-proto",target:"_blank",rel:"noopener noreferrer"}},[r._v("as-proto"),t("OutboundLink")],1),t("br"),r._v("\nProtobuf encoder/decoder library.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/JairusSW/as-json",target:"_blank",rel:"noopener noreferrer"}},[r._v("as-json"),t("OutboundLink")],1),t("br"),r._v("\nJSON encoder / decoder.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/wapc/as-msgpack",target:"_blank",rel:"noopener noreferrer"}},[r._v("as-msgpack"),t("OutboundLink")],1),t("br"),r._v("\nMessagePack package for AssemblyScript.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/nearprotocol/assemblyscript-bson",target:"_blank",rel:"noopener noreferrer"}},[r._v("assemblyscript-bson"),t("OutboundLink")],1),t("br"),r._v("\nBSON encoder / decoder.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/nearprotocol/assemblyscript-json",target:"_blank",rel:"noopener noreferrer"}},[r._v("assemblyscript-json"),t("OutboundLink")],1),t("br"),r._v("\nJSON encoder / decoder.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/01alchemist/AS-LZMA",target:"_blank",rel:"noopener noreferrer"}},[r._v("AS-LZMA"),t("OutboundLink")],1),t("br"),r._v("\nLZMA Decoder written in AssemblyScript.")])]),r._v(" "),t("h2",{attrs:{id:"crypto-non-blockchain"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#crypto-non-blockchain"}},[r._v("#")]),r._v(" Crypto (non-blockchain)")]),r._v(" "),t("ul",[t("li",[t("a",{attrs:{href:"https://github.com/mjethani/superfasthash",target:"_blank",rel:"noopener noreferrer"}},[r._v("superfasthash"),t("OutboundLink")],1),t("br"),r._v("\nAn implementation of the SuperFastHash non-cryptographic hashing algorithm in JavaScript and WebAssembly.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/jedisct1/wasm-crypto",target:"_blank",rel:"noopener noreferrer"}},[r._v("WASM-Crypto"),t("OutboundLink")],1),t("br"),r._v("\nAn AssemblyScript set of cryptographic primitives for building authentication and key exchange protocols.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/hugomrdias/rabin-wasm",target:"_blank",rel:"noopener noreferrer"}},[r._v("rabin-wasm"),t("OutboundLink")],1),t("br"),r._v("\nRabin fingerprinting implemented in WASM "),t("em",[r._v("(used by js-ipfs)")]),r._v(".")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/krisselden/xoroshiro128starstar",target:"_blank",rel:"noopener noreferrer"}},[r._v("xoroshiro128starstar"),t("OutboundLink")],1),t("br"),r._v("\nAn AssemblyScript port of xoroshiro128starstar.c")])]),r._v(" "),t("h2",{attrs:{id:"fixed-arbitrary-precision-arithmetics"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#fixed-arbitrary-precision-arithmetics"}},[r._v("#")]),r._v(" Fixed & Arbitrary Precision Arithmetics")]),r._v(" "),t("ul",[t("li",[t("a",{attrs:{href:"https://github.com/MaxGraey/as-bignum",target:"_blank",rel:"noopener noreferrer"}},[r._v("as-bignum"),t("OutboundLink")],1),t("br"),r._v("\nFixed length big numbers like "),t("code",[r._v("u128")]),r._v(", "),t("code",[r._v("i256")]),r._v(", "),t("code",[r._v("fp128")]),r._v(" and etc for AssemblyScript.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/ttulka/as-big",target:"_blank",rel:"noopener noreferrer"}},[r._v("as-big"),t("OutboundLink")],1),t("br"),r._v("\nAn AssemblyScript library for arbitrary-precision decimal arithmetic.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/polywrap/as-bigint",target:"_blank",rel:"noopener noreferrer"}},[r._v("as-bigint"),t("OutboundLink")],1),t("br"),r._v("\nBigInt is an AssemblyScript class for math with arbitrarily large integers.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/polywrap/as-bignumber",target:"_blank",rel:"noopener noreferrer"}},[r._v("as-bignumber"),t("OutboundLink")],1),t("br"),r._v("\nAn AssemblyScript class for math with arbitrary-precision decimal and integer numbers.")])]),r._v(" "),t("h2",{attrs:{id:"language-extensions-and-types"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#language-extensions-and-types"}},[r._v("#")]),r._v(" Language Extensions and Types")]),r._v(" "),t("ul",[t("li",[t("a",{attrs:{href:"https://github.com/yjhmelody/as-container",target:"_blank",rel:"noopener noreferrer"}},[r._v("as-container"),t("OutboundLink")],1),r._v(" "),t("br"),r._v("\nAssemblyScript version of Rust Option and Result etc.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/MaxGraey/as-variant",target:"_blank",rel:"noopener noreferrer"}},[r._v("as-variant"),t("OutboundLink")],1),t("br"),r._v("\nVariant (aka Any) data type for AssemblyScript.")])]),r._v(" "),t("h2",{attrs:{id:"bindings"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#bindings"}},[r._v("#")]),r._v(" Bindings")]),r._v(" "),t("ul",[t("li",[t("a",{attrs:{href:"https://github.com/lume/asdom",target:"_blank",rel:"noopener noreferrer"}},[r._v("asdom"),t("OutboundLink")],1),t("br"),r._v("\nDOM bindings for AssemblyScript.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/aspkg/ecmassembly",target:"_blank",rel:"noopener noreferrer"}},[r._v("ecmassembly"),t("OutboundLink")],1),t("br"),r._v("\nBindings for common ECMAScript/JavaScript APIs that require host scheduling ("),t("code",[r._v("setTimeout")]),r._v(", "),t("code",[r._v("Promise")]),r._v(", etc).")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/miracle2k/wasmbind",target:"_blank",rel:"noopener noreferrer"}},[r._v("wasmbind"),t("OutboundLink")],1),t("br"),r._v("\nWork with AssemblyScript memory and classes from Python.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/torch2424/as-bind",target:"_blank",rel:"noopener noreferrer"}},[r._v("as-bind"),t("OutboundLink")],1),t("br"),r._v("\n["),t("em",[r._v("Deprecated")]),r._v("] Isomorphic library to handle passing high-level data structures between AssemblyScript and JavaScript, built on top of the AssemblyScript loader.")])]),r._v(" "),t("h2",{attrs:{id:"other-libraries"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#other-libraries"}},[r._v("#")]),r._v(" Other Libraries")]),r._v(" "),t("ul",[t("li",[t("a",{attrs:{href:"https://github.com/samchon/astl",target:"_blank",rel:"noopener noreferrer"}},[r._v("ASTL"),t("OutboundLink")],1),t("br"),r._v("\n["),t("em",[r._v("Deprecated")]),r._v("] Migration project from C++ STL (Standard Template Library) to AssemblyScript. Containers, iterators, algorithms and functors are supported.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/kyranet/levenshtein-wasm",target:"_blank",rel:"noopener noreferrer"}},[r._v("Levenshtein Wasm"),t("OutboundLink")],1),t("br"),r._v("\nAn experimental lightning-fast Wasm-compiled levenshtein library.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/jedisct1/as-wasi",target:"_blank",rel:"noopener noreferrer"}},[r._v("as-wasi"),t("OutboundLink")],1),t("br"),r._v("\nAn AssemblyScript API layer for WASI system calls.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/GuildOfWeavers/galois",target:"_blank",rel:"noopener noreferrer"}},[r._v("galois"),t("OutboundLink")],1),t("br"),r._v("\nArithmetic and polynomial operations in finite fields.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/GuildOfWeavers/merkle",target:"_blank",rel:"noopener noreferrer"}},[r._v("merkle"),t("OutboundLink")],1),t("br"),r._v("\nMerkle tree and other data structures.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/jamesmilneruk/pixelmatch-asc",target:"_blank",rel:"noopener noreferrer"}},[r._v("pixelmatch-asc"),t("OutboundLink")],1),t("br"),r._v("\nPixel level image comparison library.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/onsails/wasmer-as",target:"_blank",rel:"noopener noreferrer"}},[r._v("wasmer-as"),t("OutboundLink")],1),t("br"),r._v("\nHelpers for dealing with assemblyscript memory inside wasmer-runtime.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/poria-cat/wasmer3-assemblyscript-example",target:"_blank",rel:"noopener noreferrer"}},[r._v("wasmer3-as"),t("OutboundLink")],1),t("br"),r._v("\nExamples of lift string and lower string in wasmer 3.0")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/wasmerio/io-devices-lib",target:"_blank",rel:"noopener noreferrer"}},[r._v("io-devices-lib"),t("OutboundLink")],1),t("br"),r._v("\nLibrary for interacting with the Wasmer Experimental IO Devices.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/MaxGraey/as-string-sink",target:"_blank",rel:"noopener noreferrer"}},[r._v("as-string-sink"),t("OutboundLink")],1),t("br"),r._v("\nAn efficient dynamically sized string buffer (aka String Builder) for AssemblyScript.")])]),r._v(" "),t("h2",{attrs:{id:"embedded-iot"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#embedded-iot"}},[r._v("#")]),r._v(" Embedded / IoT")]),r._v(" "),t("ul",[t("li",[t("a",{attrs:{href:"https://github.com/wasm3/wasm3-arduino/tree/main/wasm_apps",target:"_blank",rel:"noopener noreferrer"}},[r._v("wasm3-arduino"),t("OutboundLink")],1),t("br"),r._v("\nUsage example with wasm3 which run on Arduino, PlatformIO, Particle.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/vshymanskyy/Wasm3_RGB_Lamp",target:"_blank",rel:"noopener noreferrer"}},[r._v("Wasm3_RGB_Lamp"),t("OutboundLink")],1),t("br"),r._v("\nAnimating an RGB lamp, using WebAssembly (AssemblyScript).")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/alvarowolfx/wasm-arduino-wifi",target:"_blank",rel:"noopener noreferrer"}},[r._v("wasm-arduino-wifi"),t("OutboundLink")],1),t("br"),r._v("\nExample how update WebAssembly via WiFi on arduino.")])]),r._v(" "),t("h2",{attrs:{id:"testing-benchmarking"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#testing-benchmarking"}},[r._v("#")]),r._v(" Testing / Benchmarking")]),r._v(" "),t("ul",[t("li",[t("a",{attrs:{href:"https://github.com/romdotdog/as-tral",target:"_blank",rel:"noopener noreferrer"}},[r._v("as-tral"),t("OutboundLink")],1),t("br"),r._v("\nAssemblyScript benchmarking library inspired by criterion.rs. (Required AssemblyScript >= 0.20)")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/jtenner/as-pect",target:"_blank",rel:"noopener noreferrer"}},[r._v("as-pect"),t("OutboundLink")],1),t("br"),r._v("\nA test framework inspired by jest. (Required AssemblyScript <= 0.19)")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/jtenner/envy",target:"_blank",rel:"noopener noreferrer"}},[r._v("envy"),t("OutboundLink")],1),t("br"),r._v("\nA test framework spiritual successor of as-pect. (Required AssemblyScript >= 0.20)")])]),r._v(" "),t("h2",{attrs:{id:"project-templates"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#project-templates"}},[r._v("#")]),r._v(" Project Templates")]),r._v(" "),t("ul",[t("li",[t("a",{attrs:{href:"https://github.com/JamesLMilner/worker-assemblyscript-template",target:"_blank",rel:"noopener noreferrer"}},[r._v("worker-assemblyscript-template"),t("OutboundLink")],1),t("br"),r._v("\nA Cloudflare wrangler template for an AssemblyScript worker.")])]),r._v(" "),t("h2",{attrs:{id:"applications"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#applications"}},[r._v("#")]),r._v(" Applications")]),r._v(" "),t("ul",[t("li",[t("a",{attrs:{href:"https://github.com/torch2424/wasm-matrix",target:"_blank",rel:"noopener noreferrer"}},[r._v("wasm-matrix"),t("OutboundLink")],1),t("br"),r._v("\nA Matrix effect in your terminal using AssemblyScript and WASI, deployed to WAPM.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://petersalomonsen.com",target:"_blank",rel:"noopener noreferrer"}},[r._v("WebAssembly music experiment"),t("OutboundLink")],1),t("br"),r._v("\nA live coding environment in the browser for sequencing music with javascript and synthesizing instruments in AssemblyScript. Demonstrates compiling AssemblyScript directly in the browser, and live hot-swapping of webassembly modules.")]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/dested/WireWorld",target:"_blank",rel:"noopener noreferrer"}},[r._v("WireWorld"),t("OutboundLink")],1),r._v(" ("),t("a",{attrs:{href:"https://dested.com/projects/wire/",target:"_blank",rel:"noopener noreferrer"}},[r._v("demo"),t("OutboundLink")],1),r._v(")"),t("br"),r._v("\nThe Wireworld Computer in Javascript/Canvas.")])])])}),[],!1,null,null,null);e.default=n.exports}}]);
\ No newline at end of file
diff --git a/assets/js/22.79ff9157.js b/assets/js/22.79ff9157.js
new file mode 100644
index 000000000..0930307b6
--- /dev/null
+++ b/assets/js/22.79ff9157.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[22],{225:function(t,s,e){"use strict";e.r(s);var a=e(6),n=Object(a.a)({},(function(){var t=this,s=t.$createElement,e=t._self._c||s;return e("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[e("h1",{attrs:{id:"using-the-compiler"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#using-the-compiler"}},[t._v("#")]),t._v(" Using the compiler")]),t._v(" "),e("p",[t._v("Similar to TypeScript's "),e("code",[t._v("tsc")]),t._v(" transpiling to JavaScript, AssemblyScript's "),e("code",[t._v("asc")]),t._v(" compiles to WebAssembly.")]),t._v(" "),e("h2",{attrs:{id:"compiler-options"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#compiler-options"}},[t._v("#")]),t._v(" Compiler options")]),t._v(" "),e("p",[t._v("The compiler supports various options available on the command line, in a configuration file and programmatically. On the command line, it looks like this:")]),t._v(" "),e("h3",{attrs:{id:"entry-file-s"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#entry-file-s"}},[t._v("#")]),t._v(" Entry file(s)")]),t._v(" "),e("p",[t._v("Non-option arguments are treated as the names of entry files. A single program can have multiple entries, with the exports of each entry becoming the exports of the WebAssembly module. Exports of imported files that are not entry files do not become WebAssembly module exports.")]),t._v(" "),e("div",{staticClass:"language-sh extra-class"},[e("pre",{pre:!0,attrs:{class:"language-sh"}},[e("code",[t._v("asc entryFile.ts\n")])])]),e("h3",{attrs:{id:"general"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#general"}},[t._v("#")]),t._v(" General")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("--version, -v Prints just the compiler's version and exits.\n--help, -h Prints this message and exits.\n--config Configuration file to apply. CLI arguments take precedence.\n--target Configuration file target to use. Defaults to 'release'.\n")])])]),e("h3",{attrs:{id:"optimization"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#optimization"}},[t._v("#")]),t._v(" Optimization")]),t._v(" "),e("p",[t._v("The compiler can optimize for both speed ("),e("code",[t._v("-Ospeed")]),t._v(") and size ("),e("code",[t._v("-Osize")]),t._v("), as well as produce a debug build ("),e("code",[t._v("--debug")]),t._v(").")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("--optimize, -O Optimizes the module. Typical shorthands are:\n\n Default optimizations -O\n Make a release build -O --noAssert\n Make a debug build --debug\n Optimize for speed -Ospeed\n Optimize for size -Osize\n\n--optimizeLevel How much to focus on optimizing code. [0-3]\n--shrinkLevel How much to focus on shrinking code size. [0-2, s=1, z=2]\n--converge Re-optimizes until no further improvements can be made.\n--noAssert Replaces assertions with just their value without trapping.\n--uncheckedBehavior Changes the behavior of unchecked() expressions.\n Using this option can potentially cause breakage.\n\n default The default behavior: unchecked operations are\n only used inside of unchecked().\n never Unchecked operations are never used, even when,\n inside of unchecked().\n always Unchecked operations are always used if possible,\n whether or not unchecked() is used.\n\n")])])]),e("p",[t._v("Optimization levels can also be tweaked manually: "),e("code",[t._v("--optimizeLevel")]),t._v(" (0-3) indicates how much the compiler focuses on optimizing the code with "),e("code",[t._v("--shrinkLevel")]),t._v(" (0-2, 1=s, 2=z) indicating how much it focuses on keeping the size low during code generation and while optimizing. A shorthand for both is "),e("code",[t._v("-O[optimizeLevel][shrinkLevel]")]),t._v(" , with shrink level indicated by optionally appending the letter "),e("code",[t._v("s")]),t._v(" (1) or "),e("code",[t._v("z")]),t._v(" (2).")]),t._v(" "),e("h3",{attrs:{id:"output"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#output"}},[t._v("#")]),t._v(" Output")]),t._v(" "),e("p",[t._v("Typical output formats are WebAssembly binary (.wasm, "),e("code",[t._v("--outFile")]),t._v(") and/or text format (.wat, "),e("code",[t._v("--textFile")]),t._v("). Often, both are used in tandem to run and also inspect generated code.")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("--outFile, -o Specifies the WebAssembly output file (.wasm).\n--textFile, -t Specifies the WebAssembly text output file (.wat).\n--bindings, -b Specifies the bindings to generate (.js + .d.ts).\n\n esm JavaScript bindings & typings for ESM integration.\n raw Like esm, but exports just the instantiate function.\n Useful where modules are meant to be instantiated\n multiple times or non-ESM imports must be provided.\n")])])]),e("h3",{attrs:{id:"debugging"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#debugging"}},[t._v("#")]),t._v(" Debugging")]),t._v(" "),e("p",[t._v("For easier debugging during development, a "),e("a",{attrs:{href:"#source-maps"}},[t._v("source map")]),t._v(" can be emitted alongside the WebAssembly binary, and debug symbols can be embedded:")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("--sourceMap Enables source map generation. Optionally takes the URL\n used to reference the source map from the binary file.\n--debug Enables debug information in emitted binaries.\n")])])]),e("h3",{attrs:{id:"features"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#features"}},[t._v("#")]),t._v(" Features")]),t._v(" "),e("p",[t._v("There are several flags that enable or disable specific WebAssembly or compiler features. By default, only the bare minimum is exposed, and fully standardized WebAssembly features will be used.")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("--importMemory Imports the memory from 'env.memory'.\n--noExportMemory Does not export the memory as 'memory'.\n--initialMemory Sets the initial memory size in pages.\n--maximumMemory Sets the maximum memory size in pages.\n--sharedMemory Declare memory as shared. Requires maximumMemory.\n--zeroFilledMemory Assume imported memory is zeroed. Requires importMemory.\n--importTable Imports the function table from 'env.table'.\n--exportTable Exports the function table as 'table'.\n--exportStart Exports the start function using the specified name instead\n of calling it implicitly. Useful for WASI or to obtain the\n exported memory before executing any code accessing it.\n--runtime Specifies the runtime variant to include in the program.\n\n incremental TLSF + incremental GC (default)\n minimal TLSF + lightweight GC invoked externally\n stub Minimal runtime stub (never frees)\n ... Path to a custom runtime implementation\n\n--exportRuntime Always exports the runtime helpers (__new, __collect, __pin etc.).\n Automatically determined when generation of --bindings is enabled.\n--stackSize Overrides the stack size. Only relevant for incremental GC\n or when using a custom runtime that requires stack space.\n Defaults to 0 without and to 16384 with incremental GC.\n--enable Enables WebAssembly features being disabled by default.\n\n threads Threading and atomic operations.\n simd SIMD types and operations.\n reference-types Reference types and operations.\n gc Garbage collection (WIP).\n stringref String reference types.\n relaxed-simd Relaxed SIMD operations.\n\n--disable Disables WebAssembly features being enabled by default.\n\n mutable-globals Mutable global imports and exports.\n sign-extension Sign-extension operations\n nontrapping-f2i Non-trapping float to integer ops.\n bulk-memory Bulk memory operations.\n\n--use, -u Aliases a global object under another name, e.g., to switch\n the default 'Math' implementation used: --use Math=JSMath\n Can also be used to introduce an integer constant.\n--lowMemoryLimit Enforces very low (<64k) memory constraints.\n")])])]),e("h3",{attrs:{id:"linking"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#linking"}},[t._v("#")]),t._v(" Linking")]),t._v(" "),e("p",[t._v("Specifying the base offsets of compiler-generated memory respectively the table leaves some space for other data in front. In its current form this is mostly useful to link additional data into an AssemblyScript binary after compilation, be it by populating the binary itself or initializing the data externally upon initialization. One good example is leaving some scratch space for a frame buffer.")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("--memoryBase Sets the start offset of emitted memory segments.\n--tableBase Sets the start offset of emitted table elements.\n")])])]),e("h3",{attrs:{id:"api"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#api"}},[t._v("#")]),t._v(" API")]),t._v(" "),e("p",[t._v("To integrate with the compiler, for example to post-process the AST, one or multiple custom "),e("a",{attrs:{href:"#transforms"}},[t._v("transforms")]),t._v(" can be specified.")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("--transform Specifies the path to a custom transform to load.\n")])])]),e("h3",{attrs:{id:"other"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#other"}},[t._v("#")]),t._v(" Other")]),t._v(" "),e("p",[t._v("Other options include those forwarded to Binaryen and various flags useful in certain situations.")]),t._v(" "),e("h4",{attrs:{id:"binaryen"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#binaryen"}},[t._v("#")]),t._v(" Binaryen")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("--trapMode Sets the trap mode to use.\n\n allow Allow trapping operations. This is the default.\n clamp Replace trapping operations with clamping semantics.\n js Replace trapping operations with JS semantics.\n\n--runPasses Specifies additional Binaryen passes to run after other\n optimizations, if any. See: Binaryen/src/passes/pass.cpp\n--noValidate Skips validating the module using Binaryen.\n")])])]),e("h4",{attrs:{id:"and-the-kitchen-sink"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#and-the-kitchen-sink"}},[t._v("#")]),t._v(" And the kitchen sink")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("--baseDir Specifies the base directory of input and output files.\n--noColors Disables terminal colors.\n--noUnsafe Disallows the use of unsafe features in user code.\n Does not affect library files and external modules.\n--disableWarning Disables warnings matching the given diagnostic code.\n If no diagnostic code is given, all warnings are disabled.\n--noEmit Performs compilation as usual but does not emit code.\n--stats Prints statistics on I/O and compile times.\n--pedantic Make yourself sad for no good reason.\n--lib Adds one or multiple paths to custom library components and\n uses exports of all top-level files at this path as globals.\n--path Adds one or multiple paths to package resolution, similar\n to node_modules. Prefers an 'ascMain' entry in a package's\n package.json and falls back to an inner 'assembly/' folder.\n--wasm Uses the specified Wasm binary of the compiler.\n-- ... Specifies node.js options (CLI only). See: node --help\n")])])]),e("h2",{attrs:{id:"configuration-file"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#configuration-file"}},[t._v("#")]),t._v(" Configuration file")]),t._v(" "),e("p",[t._v("Instead of providing the options outlined above on the command line, a configuration file typically named "),e("strong",[t._v("asconfig.json")]),t._v(" can be used. It may look like in the following example, excluding comments:")]),t._v(" "),e("div",{staticClass:"language-json extra-class"},[e("pre",{pre:!0,attrs:{class:"language-json"}},[e("code",[e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token property"}},[t._v('"extends"')]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"./path/to/other/asconfig.json"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// (optional) base config")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token property"}},[t._v('"entries"')]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// (optional) entry files, e.g.")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"./assembly/index.ts"')]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token property"}},[t._v('"options"')]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// common options, e.g.")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token property"}},[t._v('"importTable"')]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token boolean"}},[t._v("true")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token property"}},[t._v('"targets"')]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// (optional) targets")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token property"}},[t._v('"release"')]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token comment"}},[t._v('// additional options for the "release" target, e.g.')]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token property"}},[t._v('"optimize"')]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token boolean"}},[t._v("true")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token property"}},[t._v('"outFile"')]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"myModule.release.wasm"')]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token property"}},[t._v('"debug"')]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token comment"}},[t._v('// additional options for the "debug" target, e.g.')]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token property"}},[t._v('"debug"')]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token boolean"}},[t._v("true")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token property"}},[t._v('"outFile"')]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"myModule.debug.wasm"')]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("Per-target options, e.g. "),e("code",[t._v("targets.release")]),t._v(", add to and override top-level "),e("code",[t._v("options")]),t._v(". Options provided on the command line override any options in the configuration file. Usage is, for example:")]),t._v(" "),e("div",{staticClass:"language-sh extra-class"},[e("pre",{pre:!0,attrs:{class:"language-sh"}},[e("code",[t._v("asc --config asconfig.json --target release\n")])])]),e("h2",{attrs:{id:"programmatic-usage"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#programmatic-usage"}},[t._v("#")]),t._v(" Programmatic usage")]),t._v(" "),e("p",[t._v("The compiler API can also be used programmatically:")]),t._v(" "),e("div",{staticClass:"language-js extra-class"},[e("pre",{pre:!0,attrs:{class:"language-js"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" asc "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("from")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"assemblyscript/asc"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" error"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" stdout"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" stderr"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" stats "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("await")]),t._v(" asc"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("main")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// Command line options")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"myModule.ts"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"--outFile"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"myModule.wasm"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"--optimize"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"--sourceMap"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"--stats"')]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// Additional API options")]),t._v("\n stdout"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n stderr"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n readFile"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n writeFile"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n listFiles"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n reportDiagnostic"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n transforms"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("error"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n console"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"Compilation failed: "')]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),t._v(" error"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("message"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n console"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("stderr"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("toString")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("else")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n console"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("stdout"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("toString")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("The compiler runs in browsers as well. The simplest way to set it up is to include the generated "),e("a",{attrs:{href:"https://cdn.jsdelivr.net/npm/assemblyscript@latest/dist/web.js",target:"_blank",rel:"noopener noreferrer"}},[t._v("web.js"),e("OutboundLink")],1),t._v(" so the compiler can be used with an "),e("code",[t._v("import")]),t._v(" on the Web:")]),t._v(" "),e("div",{staticClass:"language-html extra-class"},[e("pre",{pre:!0,attrs:{class:"language-html"}},[e("code",[e("span",{pre:!0,attrs:{class:"token tag"}},[e("span",{pre:!0,attrs:{class:"token tag"}},[e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("<")]),t._v("script")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("src")]),e("span",{pre:!0,attrs:{class:"token attr-value"}},[e("span",{pre:!0,attrs:{class:"token punctuation attr-equals"}},[t._v("=")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')]),t._v("https://cdn.jsdelivr.net/npm/assemblyscript@x.x.x/dist/web.js"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')])]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),e("span",{pre:!0,attrs:{class:"token script"}}),e("span",{pre:!0,attrs:{class:"token tag"}},[e("span",{pre:!0,attrs:{class:"token tag"}},[e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("")]),t._v("script")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token tag"}},[e("span",{pre:!0,attrs:{class:"token tag"}},[e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("<")]),t._v("script")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("type")]),e("span",{pre:!0,attrs:{class:"token attr-value"}},[e("span",{pre:!0,attrs:{class:"token punctuation attr-equals"}},[t._v("=")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')]),t._v("module"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')])]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),e("span",{pre:!0,attrs:{class:"token script"}},[e("span",{pre:!0,attrs:{class:"token language-javascript"}},[t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" asc "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("from")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"assemblyscript/asc"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),t._v("\n")])]),e("span",{pre:!0,attrs:{class:"token tag"}},[e("span",{pre:!0,attrs:{class:"token tag"}},[e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("")]),t._v("script")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v("\n")])])]),e("p",[t._v("Here, "),e("code",[t._v("x.x.x")]),t._v(" must be replaced with the "),e("a",{attrs:{href:"https://github.com/AssemblyScript/assemblyscript/tags",target:"_blank",rel:"noopener noreferrer"}},[t._v("respective version to use"),e("OutboundLink")],1),t._v(", or "),e("code",[t._v("latest")]),t._v(" to always use the latest version (not recommended in production). By default, the script installs "),e("a",{attrs:{href:"https://cdn.jsdelivr.net/npm/assemblyscript@latest/dist/importmap.json",target:"_blank",rel:"noopener noreferrer"}},[t._v("the necessary import map"),e("OutboundLink")],1),t._v(" and, for browsers that do not yet support import maps, "),e("a",{attrs:{href:"https://github.com/guybedford/es-module-shims",target:"_blank",rel:"noopener noreferrer"}},[t._v("an import map shim"),e("OutboundLink")],1),t._v(". It also accepts the following options in case there is a need to only perform part of the setup:")]),t._v(" "),e("table",[e("thead",[e("tr",[e("th",[t._v("Script URL")]),t._v(" "),e("th",[t._v("Effect")])])]),t._v(" "),e("tbody",[e("tr",[e("td",[e("code",[t._v("web.js?noinstall")])]),t._v(" "),e("td",[t._v("Does not install the import map.")])]),t._v(" "),e("tr",[e("td",[e("code",[t._v("web.js?noshim")])]),t._v(" "),e("td",[t._v("Does not install the import map shim.")])]),t._v(" "),e("tr",[e("td",[e("code",[t._v("web.js?noinstall,noshim")])]),t._v(" "),e("td",[t._v("Does not install the import map or shim.")])])])]),t._v(" "),e("p",[t._v("Regardless of the options used, the script always declares the following global variables:")]),t._v(" "),e("table",[e("thead",[e("tr",[e("th",[t._v("Variable")]),t._v(" "),e("th",[t._v("Description")])])]),t._v(" "),e("tbody",[e("tr",[e("td",[e("code",[t._v("ASSEMBLYSCRIPT_VERSION")])]),t._v(" "),e("td",[t._v("Version string of the compiler release used")])]),t._v(" "),e("tr",[e("td",[e("code",[t._v("ASSEMBLYSCRIPT_IMPORTMAP")])]),t._v(" "),e("td",[t._v("The respective import map of the release as JSON")])])])]),t._v(" "),e("h2",{attrs:{id:"host-bindings"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#host-bindings"}},[t._v("#")]),t._v(" Host bindings")]),t._v(" "),e("p",[t._v("WebAssembly alone cannot yet transfer higher level data types like strings, arrays and objects over module boundaries, so for now some amount of glue code is required to exchange these data structures with the host / JavaScript.")]),t._v(" "),e("p",[t._v("The compiler can generate the necessary bindings using the "),e("code",[t._v("--bindings")]),t._v(" command line option (either as an ES module or a raw instantiate function), enabling exchange of:")]),t._v(" "),e("table",[e("thead",[e("tr",[e("th",[t._v("Type")]),t._v(" "),e("th",[t._v("Strategy")]),t._v(" "),e("th",[t._v("Description")])])]),t._v(" "),e("tbody",[e("tr",[e("td",[t._v("Number")]),t._v(" "),e("td",[t._v("By value")]),t._v(" "),e("td",[t._v("Basic numeric types except 64-bit integers.")])]),t._v(" "),e("tr",[e("td",[t._v("BigInt")]),t._v(" "),e("td",[t._v("By value")]),t._v(" "),e("td",[t._v("64-bit integers via js-bigint-integration.")])]),t._v(" "),e("tr",[e("td",[t._v("Boolean")]),t._v(" "),e("td",[t._v("By value")]),t._v(" "),e("td",[t._v("Coerced to "),e("code",[t._v("true")]),t._v(" or "),e("code",[t._v("false")]),t._v(".")])]),t._v(" "),e("tr",[e("td",[t._v("Externref")]),t._v(" "),e("td",[t._v("By reference")]),t._v(" "),e("td",[t._v("Using reference-types.")])]),t._v(" "),e("tr",[e("td",[e("strong",[t._v("String")])]),t._v(" "),e("td",[t._v("Copy")]),t._v(" "),e("td")]),t._v(" "),e("tr",[e("td",[e("strong",[t._v("ArrayBuffer")])]),t._v(" "),e("td",[t._v("Copy")]),t._v(" "),e("td")]),t._v(" "),e("tr",[e("td",[e("strong",[t._v("TypedArray")])]),t._v(" "),e("td",[t._v("Copy")]),t._v(" "),e("td",[t._v("Any "),e("code",[t._v("Int8Array")]),t._v(", "),e("code",[t._v("Float64Array")]),t._v(" etc.")])]),t._v(" "),e("tr",[e("td",[e("strong",[t._v("Array")])]),t._v(" "),e("td",[t._v("Copy")]),t._v(" "),e("td",[t._v("Any "),e("code",[t._v("Array")])])]),t._v(" "),e("tr",[e("td",[e("strong",[t._v("StaticArray")])]),t._v(" "),e("td",[t._v("Copy")]),t._v(" "),e("td",[t._v("Any "),e("code",[t._v("StaticArray")])])]),t._v(" "),e("tr",[e("td",[e("strong",[t._v("Object")])]),t._v(" "),e("td",[t._v("Copy")]),t._v(" "),e("td",[t._v("If a plain object. That is: Has no constructor or non-public fields.")])]),t._v(" "),e("tr",[e("td",[e("strong",[t._v("Object")])]),t._v(" "),e("td",[t._v("By reference")]),t._v(" "),e("td",[t._v("If not a plain object. Passed as an opaque reference counted pointer.")])])])]),t._v(" "),e("p",[t._v("Note the two different strategies used for "),e("strong",[t._v("Object")]),t._v(": In some situations, say when calling a Web API, it may be preferable to copy the object as a whole, field by field, which is the strategy chosen for plain objects with no constructor or non-public fields:")]),t._v(" "),e("div",{staticClass:"language-ts extra-class"},[e("pre",{pre:!0,attrs:{class:"language-ts"}},[e("code",[e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// Copied to a JS object")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("PlainObject")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n field"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("string")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("getObject")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" PlainObject "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n field"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"hello world"')]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("However, copying may not be desirable in every situation, say when individual object properties are meant to be modified externally where serializing/deserializing the object as a whole would result in unnecessary overhead. To support this use case, the compiler can pass just an opaque reference to the object, which can be enforced by providing an empty "),e("code",[t._v("constructor")]),t._v(" (not a plain object anymore):")]),t._v(" "),e("div",{staticClass:"language-ts extra-class"},[e("pre",{pre:!0,attrs:{class:"language-ts"}},[e("code",[e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// Not copied to a JS object")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("ComplexObject")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("constructor")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// !")]),t._v("\n field"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("string")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("|")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("null")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("newObject")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" ComplexObject "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("ComplexObject")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("setObjectField")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("target"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" ComplexObject"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" field"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("string")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("|")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("null")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("void")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n target"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("field "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" field"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("getObjectField")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("target"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" ComplexObject"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("string")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("|")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("null")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" target"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("field"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("Also note that exporting an entire "),e("code",[t._v("class")]),t._v(" has no effect at the module boundary (yet), and it is instead recommended to expose only the needed functionality as shown in the example above. Supported elements at the boundary are globals, functions and enums.")]),t._v(" "),e("h3",{attrs:{id:"using-esm-bindings"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#using-esm-bindings"}},[t._v("#")]),t._v(" Using ESM bindings")]),t._v(" "),e("p",[t._v("Bindings generated with "),e("code",[t._v("--bindings esm")]),t._v(" perform all the steps from compilation over instantiation to exporting the final interface. To do so, a few assumptions had to be made:")]),t._v(" "),e("ul",[e("li",[e("p",[t._v("The WebAssembly binary is located next to the JavaScript bindings file using the same name but with a "),e("code",[t._v(".wasm")]),t._v(" extension.")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("build/mymodule.js\nbuild/mymodule.wasm\n")])])]),e("div",{staticClass:"language-js extra-class"},[e("pre",{pre:!0,attrs:{class:"language-js"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("*")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("as")]),t._v(" myModule "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("from")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"./build/mymodule.js"')]),t._v("\n")])])])]),t._v(" "),e("li",[e("p",[t._v("JavaScript globals in "),e("code",[t._v("globalThis")]),t._v(" can be accessed directly via the "),e("code",[t._v("env")]),t._v(" module namespace. For example, "),e("code",[t._v("console.log")]),t._v(" can be manually imported through:")]),t._v(" "),e("div",{staticClass:"language-ts extra-class"},[e("pre",{pre:!0,attrs:{class:"language-ts"}},[e("code",[e("span",{pre:!0,attrs:{class:"token decorator"}},[e("span",{pre:!0,attrs:{class:"token at operator"}},[t._v("@")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("external")])]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"env"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"console.log"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("declare")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("consoleLog")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("s"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("string")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("void")]),t._v("\n")])])]),e("p",[t._v("Note that this is just an example and "),e("code",[t._v("console.log")]),t._v(" is already provided by the standard library when called from an AssemblyScript file. Other global functions not already provided by the standard library may require an import as of this example, though.")])]),t._v(" "),e("li",[e("p",[t._v("Imports from other namespaces than "),e("code",[t._v("env")]),t._v(", i.e. "),e("code",[t._v('(import "module" "name")')]),t._v(", become an "),e("code",[t._v('import { name } from "module"')]),t._v(" within the binding. Importing a custom function from a JavaScript file next to the bindings file can be achieved through:")]),t._v(" "),e("div",{staticClass:"language-ts extra-class"},[e("pre",{pre:!0,attrs:{class:"language-ts"}},[e("code",[e("span",{pre:!0,attrs:{class:"token decorator"}},[e("span",{pre:!0,attrs:{class:"token at operator"}},[t._v("@")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("external")])]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"./otherfile.js"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"myFunction"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("declare")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("myFunction")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),t._v("\n")])])]),e("p",[t._v("Similarly, importing a custom function from, say, a Node.js dependency can be achieved through:")]),t._v(" "),e("div",{staticClass:"language-ts extra-class"},[e("pre",{pre:!0,attrs:{class:"language-ts"}},[e("code",[e("span",{pre:!0,attrs:{class:"token decorator"}},[e("span",{pre:!0,attrs:{class:"token at operator"}},[t._v("@")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("external")])]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"othermodule"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"myFunction"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("declare")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("myFunction")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),t._v("\n")])])])])]),t._v(" "),e("p",[t._v("These assumptions cannot be intercepted or customized since, to provide static ESM exports from the bindings file directly, instantiation must start immediately when the bindings file is imported. If customization is required, "),e("code",[t._v("--bindings raw")]),t._v(" can be used instead.")]),t._v(" "),e("h3",{attrs:{id:"using-raw-bindings"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#using-raw-bindings"}},[t._v("#")]),t._v(" Using raw bindings")]),t._v(" "),e("p",[t._v("The signature of the single "),e("code",[t._v("instantiate")]),t._v(" function exported by "),e("code",[t._v("--bindings raw")]),t._v(" is:")]),t._v(" "),e("div",{staticClass:"language-ts extra-class"},[e("pre",{pre:!0,attrs:{class:"language-ts"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("async")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("instantiate")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("module"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" WebAssembly"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Module"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" imports"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" WebAssembly"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Imports"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" AdaptedExports\n")])])]),e("p",[t._v("Note that the function does not make any assumptions on how the module is to be compiled, but instead expects a readily compiled "),e("code",[t._v("WebAssembly.Module")]),t._v(" as in this example:")]),t._v(" "),e("div",{staticClass:"language-js extra-class"},[e("pre",{pre:!0,attrs:{class:"language-js"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" instantiate "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("from")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"./module.js"')]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" exports "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("await")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("instantiate")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("await")]),t._v(" WebAssembly"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("compileStreaming")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("fetch")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"./module.wasm"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("/* imports */")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),e("p",[t._v("Unlike "),e("code",[t._v("--bindings esm")]),t._v(", raw bindings also do not make any assumptions on how imports are resolved, so these must be provided manually as part of the imports object. For example, to achieve a similar result as with ESM bindings, but now customizable:")]),t._v(" "),e("div",{staticClass:"language-js extra-class"},[e("pre",{pre:!0,attrs:{class:"language-js"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" instantiate "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("from")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"./module.js"')]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("*")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("as")]),t._v(" other "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("from")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"./otherfile.js"')]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n export1"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n export2"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("await")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("instantiate")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("await")]),t._v(" WebAssembly"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("compileStreaming")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("fetch")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"./module.wasm"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token string-property property"}},[t._v('"./otherfile.js"')]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" other\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),e("h2",{attrs:{id:"debugging-2"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#debugging-2"}},[t._v("#")]),t._v(" Debugging")]),t._v(" "),e("p",[t._v("The debugging workflow is similar to debugging JavaScript since both Wasm and JS execute in the same engine, and the compiler provides various options to set up additional WebAssembly-specific debug information. Note that any sort of optimization should be disabled in debug builds.")]),t._v(" "),e("h3",{attrs:{id:"debug-symbols"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#debug-symbols"}},[t._v("#")]),t._v(" Debug symbols")]),t._v(" "),e("p",[t._v("When compiling with the "),e("code",[t._v("--debug")]),t._v(" option, the compiler appends a name section to the binary, containing names of functions, globals, locals and so on. These names will show up in stack traces.")]),t._v(" "),e("h3",{attrs:{id:"source-maps"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#source-maps"}},[t._v("#")]),t._v(" Source maps")]),t._v(" "),e("p",[t._v("The compiler can generate a source map alongside a binary using the "),e("code",[t._v("--sourceMap")]),t._v(" option. By default, a relative source map path will be embedded in the binary which browsers can pick up when instantiating a module from a "),e("code",[t._v("fetch")]),t._v(" response. In environments that do not provide "),e("code",[t._v("fetch")]),t._v(" or an equivalent mechanism, like in Node.js, it is alternatively possible to embed an absolute source map path through "),e("code",[t._v("--sourceMap path/to/source/map")]),t._v(".")]),t._v(" "),e("h3",{attrs:{id:"breakpoints"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#breakpoints"}},[t._v("#")]),t._v(" Breakpoints")]),t._v(" "),e("p",[t._v("Some JavaScript engines also support adding break points directly in WebAssembly code. Please consult your engine's documentation: "),e("a",{attrs:{href:"https://developers.google.com/web/tools/chrome-devtools/javascript/breakpoints",target:"_blank",rel:"noopener noreferrer"}},[t._v("Chrome"),e("OutboundLink")],1),t._v(", "),e("a",{attrs:{href:"https://developer.mozilla.org/en-US/docs/Tools/Debugger/How_to/Set_a_breakpoint",target:"_blank",rel:"noopener noreferrer"}},[t._v("Firefox"),e("OutboundLink")],1),t._v(", "),e("a",{attrs:{href:"https://nodejs.org/api/debugger.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("Node.js"),e("OutboundLink")],1),t._v(", "),e("a",{attrs:{href:"https://support.apple.com/de-de/guide/safari-developer/dev5e4caf347/mac",target:"_blank",rel:"noopener noreferrer"}},[t._v("Safari"),e("OutboundLink")],1),t._v(".")]),t._v(" "),e("h2",{attrs:{id:"transforms"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#transforms"}},[t._v("#")]),t._v(" Transforms")]),t._v(" "),e("p",[t._v("AssemblyScript is compiled statically, so code transformation cannot be done at runtime but must instead be performed at compile-time. To enable this, the compiler frontend (asc) provides a mechanism to hook into the compilation process before, while and after the module is being compiled.")]),t._v(" "),e("p",[t._v("Specifying "),e("code",[t._v("--transform ./myTransform.js")]),t._v(" on the command line will load the node module pointed to by "),e("code",[t._v("./myTransform.js")]),t._v(".")]),t._v(" "),e("div",{staticClass:"language-js extra-class"},[e("pre",{pre:!0,attrs:{class:"language-js"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("*")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("as")]),t._v(" assemblyscript "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("from")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"assemblyscript"')]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" Transform "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("from")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"assemblyscript/transform"')]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("MyTransform")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Transform")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("default")]),t._v(" MyTransform\n")])])]),e("h3",{attrs:{id:"properties"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#properties"}},[t._v("#")]),t._v(" Properties")]),t._v(" "),e("p",[t._v("A transform is an ES6 class/node module with the following inherited properties:")]),t._v(" "),e("ul",[e("li",[e("div",{staticClass:"language-ts extra-class"},[e("pre",{pre:!0,attrs:{class:"language-ts"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("readonly")]),t._v(" program"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Program\n")])])]),e("p",[t._v("Reference to the "),e("code",[t._v("Program")]),t._v(" instance.")])]),t._v(" "),e("li",[e("div",{staticClass:"language-ts extra-class"},[e("pre",{pre:!0,attrs:{class:"language-ts"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("readonly")]),t._v(" baseDir"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("string")]),t._v("\n")])])]),e("p",[t._v("Base directory used by the compiler.")])]),t._v(" "),e("li",[e("div",{staticClass:"language-ts extra-class"},[e("pre",{pre:!0,attrs:{class:"language-ts"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("readonly")]),t._v(" stdout"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" OutputStream\n")])])]),e("p",[t._v("Output stream used by the compiler.")])]),t._v(" "),e("li",[e("div",{staticClass:"language-ts extra-class"},[e("pre",{pre:!0,attrs:{class:"language-ts"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("readonly")]),t._v(" stderr"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" OutputStream\n")])])]),e("p",[t._v("Error stream uses by the compiler.")])]),t._v(" "),e("li",[e("div",{staticClass:"language-ts extra-class"},[e("pre",{pre:!0,attrs:{class:"language-ts"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("readonly")]),t._v(" log"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("typeof")]),t._v(" console"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("log\n")])])]),e("p",[t._v("Logs a message to console.")])]),t._v(" "),e("li",[e("div",{staticClass:"language-ts extra-class"},[e("pre",{pre:!0,attrs:{class:"language-ts"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("writeFile")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("filename"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("string")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" contents"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("string")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("|")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Uint8Array")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" baseDir"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("string")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("boolean")]),t._v("\n")])])]),e("p",[t._v("Writes a file to disk.")])]),t._v(" "),e("li",[e("div",{staticClass:"language-ts extra-class"},[e("pre",{pre:!0,attrs:{class:"language-ts"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("readFile")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("filename"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("string")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" baseDir"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("string")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("string")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("|")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("null")]),t._v("\n")])])]),e("p",[t._v("Reads a file from disk.")])]),t._v(" "),e("li",[e("div",{staticClass:"language-ts extra-class"},[e("pre",{pre:!0,attrs:{class:"language-ts"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("listFiles")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("dirname"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("string")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" baseDir"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("string")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("string")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("|")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("null")]),t._v("\n")])])]),e("p",[t._v("Lists all files in a directory.")])])]),t._v(" "),e("h3",{attrs:{id:"hooks"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#hooks"}},[t._v("#")]),t._v(" Hooks")]),t._v(" "),e("p",[t._v("The frontend will call several hooks, if present on the transform, during the compilation process:")]),t._v(" "),e("ul",[e("li",[e("div",{staticClass:"language-ts extra-class"},[e("pre",{pre:!0,attrs:{class:"language-ts"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("afterParse")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("parser"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Parser"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("void")]),t._v("\n")])])]),e("p",[t._v("Called when parsing is complete, before a program is initialized from the AST. Note that types are not yet known at this stage and there is no easy way to obtain them.")])]),t._v(" "),e("li",[e("div",{staticClass:"language-ts extra-class"},[e("pre",{pre:!0,attrs:{class:"language-ts"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("afterInitialize")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("program"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Program"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("void")]),t._v("\n")])])]),e("p",[t._v("Called once the program is initialized, before it is being compiled. Types are known at this stage, respectively can be resolved where necessary.")])]),t._v(" "),e("li",[e("div",{staticClass:"language-ts extra-class"},[e("pre",{pre:!0,attrs:{class:"language-ts"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("afterCompile")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("module"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Module"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("void")]),t._v("\n")])])]),e("p",[t._v("Called with the resulting module before it is being emitted. Useful to modify the IR before writing any output, for example to replace imports with actual functionality or to add custom sections.")])])]),t._v(" "),e("p",[t._v("Transforms are a very powerful feature, but may require profound knowledge of the compiler to utilize them to their full extent, so reading through the compiler sources is a plus.")]),t._v(" "),e("h2",{attrs:{id:"portability"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#portability"}},[t._v("#")]),t._v(" Portability")]),t._v(" "),e("p",[t._v("With AssemblyScript being very similar to TypeScript, there comes the opportunity to compile the same code to JavaScript with "),e("code",[t._v("tsc")]),t._v(" and WebAssembly with "),e("code",[t._v("asc")]),t._v(". The AssemblyScript compiler itself is portable code. Writing portable code is largely a matter of double-checking that the intent translates to the same outcome in both the strictly typed AssemblyScript and the types-stripped-away TypeScript worlds.")]),t._v(" "),e("h3",{attrs:{id:"portable-standard-library"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#portable-standard-library"}},[t._v("#")]),t._v(" Portable standard library")]),t._v(" "),e("p",[t._v("Besides the full standard library, AssemblyScript provides a portable variant of the functionality that is present in both JavaScript and WebAssembly. In addition to that, the portable library lifts some of the functionality that is only available with "),e("code",[t._v("asc")]),t._v(" to JavaScript, like the portable conversions mentioned below.")]),t._v(" "),e("p",[t._v("Also note that some parts of JavaScript's standard library function a little more loosely than how they would when compiling to WebAssembly. While the portable definitions try to take care of this, one example where this can happen is "),e("code",[t._v("Map#get")]),t._v(" returning "),e("code",[t._v("undefined")]),t._v(" when a key cannot be found in JavaScript, while resulting in an abort in WebAssembly, where it is necessary to first check that the key exists using "),e("code",[t._v("Map#has")]),t._v(".")]),t._v(" "),e("p",[t._v("To use the portable library, extend "),e("code",[t._v("assemblyscript/std/portable.json")]),t._v(" instead of "),e("code",[t._v("assemblyscript/std/assembly.json")]),t._v(" within "),e("code",[t._v("tsconfig.json")]),t._v(" and add the following somewhere along your build step so the portable features are present in the environment:")]),t._v(" "),e("div",{staticClass:"language-js extra-class"},[e("pre",{pre:!0,attrs:{class:"language-js"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"assemblyscript/std/portable.js"')]),t._v("\n")])])]),e("p",[t._v("Note that the portable standard library is still a work in progress and so far focuses on functionality useful to make the compiler itself portable, so if you need something specific, feel free to improve "),e("a",{attrs:{href:"https://github.com/AssemblyScript/assemblyscript/tree/main/std/portable",target:"_blank",rel:"noopener noreferrer"}},[t._v("its definitions and feature set"),e("OutboundLink")],1),t._v(".")]),t._v(" "),e("h3",{attrs:{id:"portable-conversions"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#portable-conversions"}},[t._v("#")]),t._v(" Portable conversions")]),t._v(" "),e("p",[t._v("While "),e("code",[t._v("asc")]),t._v(" understands the meaning of")]),t._v(" "),e("div",{staticClass:"language-ts extra-class"},[e("pre",{pre:!0,attrs:{class:"language-ts"}},[e("code",[e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// non-portable")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" someFloat"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("f32")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token number"}},[t._v("1.5")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" someInt"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("i32")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("i32")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v("someFloat\n")])])]),e("p",[t._v("and then inserts the correct conversion steps, "),e("code",[t._v("tsc")]),t._v(" does not because all numeric types are just aliases of "),e("code",[t._v("number")]),t._v(". Hence, when targeting JavaScript with "),e("code",[t._v("tsc")]),t._v(", the above will result in")]),t._v(" "),e("div",{staticClass:"language-js extra-class"},[e("pre",{pre:!0,attrs:{class:"language-js"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("var")]),t._v(" someFloat "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token number"}},[t._v("1.5")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("var")]),t._v(" someInt "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" someFloat\n")])])]),e("p",[t._v("which is obviously wrong. To account for this, portable conversions can be used, resulting in actually portable code. For example")]),t._v(" "),e("div",{staticClass:"language-ts extra-class"},[e("pre",{pre:!0,attrs:{class:"language-ts"}},[e("code",[e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// portable")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" someFloat"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("f32")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token number"}},[t._v("1.5")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" someInt"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("i32")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("i32")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("someFloat"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),e("p",[t._v("will essentially result in")]),t._v(" "),e("div",{staticClass:"language-js extra-class"},[e("pre",{pre:!0,attrs:{class:"language-js"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("var")]),t._v(" someFloat "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token number"}},[t._v("1.5")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("var")]),t._v(" someInt "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" someFloat "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("|")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),t._v("\n")])])]),e("p",[t._v("which is correct. The best way of dealing with this is asking yourself the question: What would this code do when compiled to JavaScript?")]),t._v(" "),e("h3",{attrs:{id:"portable-overflows"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#portable-overflows"}},[t._v("#")]),t._v(" Portable overflows")]),t._v(" "),e("p",[t._v("Likewise, again because "),e("code",[t._v("asc")]),t._v(" knows the meaning but "),e("code",[t._v("tsc")]),t._v(" does not, overflows must be handled explicitly:")]),t._v(" "),e("div",{staticClass:"language-ts extra-class"},[e("pre",{pre:!0,attrs:{class:"language-ts"}},[e("code",[e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// non-portable")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" someU8"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("u8")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token number"}},[t._v("255")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" someOtherU8"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("u8")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" someU8 "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),t._v("\n")])])]),e("div",{staticClass:"language-ts extra-class"},[e("pre",{pre:!0,attrs:{class:"language-ts"}},[e("code",[e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// portable")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" someU8"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("u8")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token number"}},[t._v("255")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" someOtherU8"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("u8")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("u8")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("someU8 "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),e("p",[t._v("essentially resulting in")]),t._v(" "),e("div",{staticClass:"language-js extra-class"},[e("pre",{pre:!0,attrs:{class:"language-js"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" someU8 "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token number"}},[t._v("255")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" someOtherU8 "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("someU8 "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("&")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token number"}},[t._v("0xff")]),t._v("\n")])])]),e("h3",{attrs:{id:"non-portable-code"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#non-portable-code"}},[t._v("#")]),t._v(" Non-portable code")]),t._v(" "),e("p",[t._v("In JavaScript, all numeric values are IEEE754 doubles that cannot represent the full range of values fitting in a 64-bit integer ("),e("a",{attrs:{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER",target:"_blank",rel:"noopener noreferrer"}},[t._v("max. safe integer"),e("OutboundLink")],1),t._v(" is "),e("code",[t._v("2^53 - 1")]),t._v("). Hence "),e("code",[t._v("i64")]),t._v(" and "),e("code",[t._v("u64")]),t._v(" are not portable and not present in "),e("code",[t._v("std/portable")]),t._v(". There are several ways to deal with this. One is to use an i64 polyfill like "),e("a",{attrs:{href:"https://github.com/AssemblyScript/examples/tree/main/i64",target:"_blank",rel:"noopener noreferrer"}},[t._v("in this example"),e("OutboundLink")],1),t._v(".")]),t._v(" "),e("p",[t._v("Other than that, portable code (JavaScript) does not have a concept of memory, so there are no "),e("code",[t._v("load")]),t._v(" and "),e("code",[t._v("store")]),t._v(" implementations in the portable standard library. Technically this can be polyfilled in various ways, but no default is provided since actual implementations are expected to be relatively specific (for instance: the portable compiler accesses Binaryen's memory).")])])}),[],!1,null,null,null);s.default=n.exports}}]);
\ No newline at end of file
diff --git a/assets/js/23.ed294d2e.js b/assets/js/23.ed294d2e.js
new file mode 100644
index 000000000..7636324d8
--- /dev/null
+++ b/assets/js/23.ed294d2e.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[23],{224:function(t,s,a){"use strict";a.r(s);var e=a(6),n=Object(e.a)({},(function(){var t=this,s=t.$createElement,a=t._self._c||s;return a("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[a("h1",{attrs:{id:"concepts"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#concepts"}},[t._v("#")]),t._v(" Concepts")]),t._v(" "),a("p",[t._v("An overview of basic AssemblyScript concepts.")]),t._v(" "),a("h2",{attrs:{id:"typescript-like"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#typescript-like"}},[t._v("#")]),t._v(" TypeScript-like")]),t._v(" "),a("p",[t._v("AssemblyScript is very similar to TypeScript with largely compatible syntax and semantics. As such, many of the concepts known from TypeScript apply to AssemblyScript as well, but not all TypeScript features map well to ahead of time compilation or WebAssembly's so far supported feature set. Some features have been omitted, others not yet implemented, and a few additional concepts needed to be added, technically making AssemblyScript part a subset, part a superset - a variant. As such it is unlikely that existing TypeScript code can be compiled by the AssemblyScript compiler, but likely that sufficiently strict code can be ported with little effort.")]),t._v(" "),a("p",[t._v("A detailed overview of supported TypeScript features is available within "),a("RouterLink",{attrs:{to:"/status.html"}},[t._v("Implementation status")]),t._v(".")],1),t._v(" "),a("h2",{attrs:{id:"strictly-typed"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#strictly-typed"}},[t._v("#")]),t._v(" Strictly typed")]),t._v(" "),a("p",[t._v("While TypeScript has types, its type system is able to describe many of JavaScript's dynamic features. TypeScript is a superset / a type checker on top of JavaScript after all. On the contrary, AssemblyScript is compiled statically ahead of time, making it infeasible to support very dynamic JavaScript features to not enter interpreter territory, respectively requires stricter type checking to guarantee correctness at runtime where TypeScript would not complain.")]),t._v(" "),a("p",[t._v("As a result, there is no "),a("code",[t._v("any")]),t._v(" or "),a("code",[t._v("undefined")]),t._v(":")]),t._v(" "),a("div",{staticClass:"language-ts extra-class"},[a("pre",{pre:!0,attrs:{class:"language-ts"}},[a("code",[a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 😢")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("foo")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("a"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("var")]),t._v(" b "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" a "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" b\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 😊")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("foo")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("a"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("i32")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("i32")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("var")]),t._v(" b "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" a "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" b\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),a("p",[t._v("There are no union types yet, but a similar effect can be achieved with generics:")]),t._v(" "),a("div",{staticClass:"language-ts extra-class"},[a("pre",{pre:!0,attrs:{class:"language-ts"}},[a("code",[a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 😢")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("foo")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("a"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("i32")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("|")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("string")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("void")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 😊")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token generic-function"}},[a("span",{pre:!0,attrs:{class:"token function"}},[t._v("foo")]),a("span",{pre:!0,attrs:{class:"token generic class-name"}},[a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("T")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")])])]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("a"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("T")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("void")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),a("p",[t._v("Objects must be typed, say using a "),a("code",[t._v("Map")]),t._v(" or "),a("code",[t._v("class")]),t._v(":")]),t._v(" "),a("div",{staticClass:"language-ts extra-class"},[a("pre",{pre:!0,attrs:{class:"language-ts"}},[a("code",[a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 😢")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("var")]),t._v(" a "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\na"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("prop "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"hello world"')]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 😊")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("var")]),t._v(" a "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Map"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("string")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("string")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")])]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\na"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("set")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"prop"')]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"hello world"')]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 😊")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token class-name"}},[a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("A")])]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("constructor")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("public")]),t._v(" prop"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("string")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("var")]),t._v(" a "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token class-name"}},[a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("A")])]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"hello world"')]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),a("p",[t._v("And nullability checks are limited to locals to guarantee soundness where TypeScript "),a("a",{attrs:{href:"https://www.typescriptlang.org/play?#code/G4QwTgBAZg9jBcEDOAXMBLAdgcwgHwkwFcAbEiAXggCIRqBuAKEfSggApYYBKCAb0YRkAUxQAxOADlSJdtyZCuAOhLCcKABb0IAeh2EYEYWDAwwjAL7MoRTAGMU6GJhHipMuf0HQ4lQjKYrIA",target:"_blank",rel:"noopener noreferrer"}},[t._v("would not"),a("OutboundLink")],1),t._v(" "),a("a",{attrs:{href:"https://www.typescriptlang.org/play/index.html#code/MYGwhgzhAEBiD29oG8BQ0PQvAtgUwBcALASwDsBzALiwICdyLoAfaMgVxBGgF43OQAblQBfVKgBm7MsAIl4ZaABN4AZVyFSlABQTENBPACUKdJhITouxADps+YoxNpMr5Wo2PKAURAQ81sbCbph68HaeWhQ2IHiUxILQAPRJWETwnErQeHR08HQANNAARuwE7ngQZADkBGYYYmKS0rLyiirqDlG+-oEGiM710GERXYy8-FzCIkA",target:"_blank",rel:"noopener noreferrer"}},[t._v("diagnose"),a("OutboundLink")],1),t._v(" "),a("a",{attrs:{href:"https://www.typescriptlang.org/play/index.html#code/MYGwhgzhAEBiD29oG8BQ0PQPoXgWwFMAXACwEsA7AcwC5oIiAnSq6AH2goFcQRoBeaACISBXvCEBudJirF6+YuWoAKAJR0Gzau048+aTEegh5jeYNJkIAOhyKr1accxXb9wo9aDuvZy+hzIi5GCkDifwwAX1QY1AAzLgpgIjJ4MIATeABlB2UqFXjEOgR4NRQZDDJ46ELEG1xPfPLDAKL4BryWG1NqUkloAHpB+hJ4HgzoAkZGeEYAGmgAIy4iaCyCCAoAciJK6BiYoA",target:"_blank",rel:"noopener noreferrer"}},[t._v("a problem"),a("OutboundLink")],1),t._v(":")]),t._v(" "),a("div",{staticClass:"language-ts extra-class"},[a("pre",{pre:!0,attrs:{class:"language-ts"}},[a("code",[a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("doSomething")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("foo"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Foo"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("void")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 😢")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("foo"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("something"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n foo"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("something"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("length "),a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// fails")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("doSomething")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("foo"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Foo"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("void")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// 😊")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("var")]),t._v(" something "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" foo"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("something\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("something"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n something"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("length "),a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// works")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),a("h2",{attrs:{id:"sandboxed-execution"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#sandboxed-execution"}},[t._v("#")]),t._v(" Sandboxed execution")]),t._v(" "),a("p",[t._v("One of WebAssembly's unique features is that a module cannot access external resources without explicitly importing them, providing strong security guarantees by default. As such, to do anything useful with WebAssembly, it is necessary to wire a module to the host environment, like for example JavaScript and the DOM.")]),t._v(" "),a("h3",{attrs:{id:"module-imports"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#module-imports"}},[t._v("#")]),t._v(" Module imports")]),t._v(" "),a("p",[t._v("In AssemblyScript, host functionality can be imported by utilizing the ambient context, that is using a "),a("code",[t._v("declare")]),t._v(" statement:")]),t._v(" "),a("div",{staticClass:"language-ts extra-class"},[a("pre",{pre:!0,attrs:{class:"language-ts"}},[a("code",[a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// assembly/env.ts")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("declare")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("logInteger")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("i"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("i32")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("void")]),t._v("\n")])])]),a("div",{staticClass:"language-ts extra-class"},[a("pre",{pre:!0,attrs:{class:"language-ts"}},[a("code",[a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// assembly/index.ts")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" logInteger "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("from")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"./env"')]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("logInteger")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("42")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),a("p",[t._v("Ambient declarations in an AssemblyScript file will yield a WebAssembly module import, using the internal path of the file, without file extension, as the module name (here: "),a("code",[t._v("assembly/env")]),t._v("), and the name of the declared element as the module element (here "),a("code",[t._v("logInteger")]),t._v("). In the example above, the import can be fulfilled by providing the following imports object upon instantiation:")]),t._v(" "),a("div",{staticClass:"language-js extra-class"},[a("pre",{pre:!0,attrs:{class:"language-js"}},[a("code",[t._v("WebAssembly"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("instantiateStreaming")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("fetch")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token string-property property"}},[t._v('"assembly/env"')]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("logInteger")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("i")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" console"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"logInteger: "')]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),t._v(" i"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),a("p",[t._v("If necessary, the respective external module and element names can also be overridden using the "),a("code",[t._v("@external")]),t._v(" decorator and modifying the imports object accordingly:")]),t._v(" "),a("div",{staticClass:"language-ts extra-class"},[a("pre",{pre:!0,attrs:{class:"language-ts"}},[a("code",[a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// assembly/index.ts")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token decorator"}},[a("span",{pre:!0,attrs:{class:"token at operator"}},[t._v("@")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("external")])]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"log"')]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"integer"')]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("declare")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("logInteger")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("i"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("i32")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("void")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token comment"}},[t._v('// { "log": { "integer"(i) { ... } } }')]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("logInteger")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("42")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),a("h3",{attrs:{id:"module-exports"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#module-exports"}},[t._v("#")]),t._v(" Module exports")]),t._v(" "),a("p",[t._v("Similarly, "),a("code",[t._v("export")]),t._v("s from an entry file will yield WebAssembly module exports:")]),t._v(" "),a("div",{staticClass:"language-ts extra-class"},[a("pre",{pre:!0,attrs:{class:"language-ts"}},[a("code",[a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// assembly/index.ts")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("add")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("a"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("i32")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" b"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("i32")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("i32")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" a "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),t._v(" b\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),a("p",[t._v("Module exports can then be called from the host environment:")]),t._v(" "),a("div",{staticClass:"language-js extra-class"},[a("pre",{pre:!0,attrs:{class:"language-js"}},[a("code",[a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token literal-property property"}},[t._v("instance")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" exports "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("await")]),t._v(" WebAssembly"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("instantiateStreaming")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\nconsole"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("exports"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("add")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("2")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),a("p",[t._v("See also: "),a("RouterLink",{attrs:{to:"/compiler.html#host-bindings"}},[t._v("Host bindings")]),t._v(" automate much of the wiring.")],1),t._v(" "),a("h3",{attrs:{id:"special-imports"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#special-imports"}},[t._v("#")]),t._v(" Special imports")]),t._v(" "),a("p",[t._v("Some language features need support from the host environment to function, yielding a few special module imports depending on the feature set used within the module. Generated bindings provide these automatically where necessary.")]),t._v(" "),a("ul",[a("li",[a("div",{staticClass:"language-ts extra-class"},[a("pre",{pre:!0,attrs:{class:"language-ts"}},[a("code",[a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" env"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("abort"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("message"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("usize")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" fileName"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("usize")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" line"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("u32")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" column"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("u32")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("void")]),t._v("\n")])])]),a("p",[t._v("Called on unrecoverable errors. Typically present if assertions are enabled or errors are thrown.")])]),t._v(" "),a("li",[a("div",{staticClass:"language-ts extra-class"},[a("pre",{pre:!0,attrs:{class:"language-ts"}},[a("code",[a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" env"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("trace"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("message"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("usize")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" n"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("i32")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" a0"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token number"}},[t._v(".4")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("f64")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("void")]),t._v("\n")])])]),a("p",[t._v("Called when "),a("code",[t._v("trace")]),t._v(" is called in user code. Only present if it is.")])]),t._v(" "),a("li",[a("div",{staticClass:"language-ts extra-class"},[a("pre",{pre:!0,attrs:{class:"language-ts"}},[a("code",[a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" env"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("seed"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("f64")]),t._v("\n")])])]),a("p",[t._v("Called when the random number generator needs to be seeded. Only present if it is.")])])]),t._v(" "),a("p",[t._v("The respective implementations of "),a("code",[t._v("abort")]),t._v(", "),a("code",[t._v("trace")]),t._v(" and "),a("code",[t._v("seed")]),t._v(" can be overridden with, for example, "),a("code",[t._v("--use abort=assembly/index/myAbort")]),t._v(", here redirecting calls to "),a("code",[t._v("abort")]),t._v(" to a custom "),a("code",[t._v("myAbort")]),t._v(" function in "),a("code",[t._v("assembly/index.ts")]),t._v(". Useful if an environment does not provide compatible implementations, or when the respective imports are not desired and custom implementations are sufficient.")]),t._v(" "),a("h3",{attrs:{id:"accessing-memory-during-instantiation"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#accessing-memory-during-instantiation"}},[t._v("#")]),t._v(" Accessing memory during instantiation")]),t._v(" "),a("p",[t._v("One important edge case to be aware of is that top-level statements are executed as part of the WebAssembly module's implicit "),a("code",[t._v("(start ...)")]),t._v(" function by default, which leads to a chicken and egg problem when top-level statements already call out to external functionality that needs to access the module's memory instance (say, reading the contents of a logged string). Since instantiation did not yet complete, the module's exports, including exported memory, are not available yet and the access will fail.")]),t._v(" "),a("p",[t._v("A solution is to utilize the "),a("code",[t._v("--exportStart")]),t._v(" command line option to force exporting the start function instead of making it implicit. Then, instantiation first returns before any code is executed. Note, however, that the exported start function must always be called first, before any other exports, or undefined behavior will occur.")]),t._v(" "),a("h2",{attrs:{id:"tree-shaking"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#tree-shaking"}},[t._v("#")]),t._v(" Tree-shaking")]),t._v(" "),a("p",[t._v("AssemblyScript does not compile a module linearly, but starts at the module's exports and only compiles what's reachable from them, often referred to as "),a("a",{attrs:{href:"https://en.wikipedia.org/wiki/Tree_shaking",target:"_blank",rel:"noopener noreferrer"}},[t._v("tree-shaking"),a("OutboundLink")],1),t._v(". As such, dead code is always validated syntactically, but not necessarily checked for semantic correctness. While this mechanism significantly helps to reduce compile times and feels almost natural to those familiar with "),a("em",[t._v("executing")]),t._v(" JavaScript, it may initially feel a little strange not only to those with a background in traditional compilers, for example because emitted diagnostics do not happen linearly, but also to those with a background in TypeScript, because even type annotations remain unchecked as part of dead code. The exception to the rule is top-level code, including top-level variable declarations and their initializers, that must be evaluated as soon as the respective file would first execute.")]),t._v(" "),a("h3",{attrs:{id:"branch-level-tree-shaking"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#branch-level-tree-shaking"}},[t._v("#")]),t._v(" Branch-level tree-shaking")]),t._v(" "),a("p",[t._v("In addition to module-level tree-shaking, the compiler ignores branches that it can prove won't be taken. Works with constants, built-ins that compile to a constant, expressions that can be precomputed to a constant, plus the following globals to detect specific compiler flags or features:")]),t._v(" "),a("ul",[a("li",[a("div",{staticClass:"language-ts extra-class"},[a("pre",{pre:!0,attrs:{class:"language-ts"}},[a("code",[a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("ASC_TARGET")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("i32")]),t._v("\n")])])]),a("p",[t._v("Indicates the compilation target. Possible values are 0 = JS (portable), 1 = WASM32, 2 = WASM64.")])]),t._v(" "),a("li",[a("div",{staticClass:"language-ts extra-class"},[a("pre",{pre:!0,attrs:{class:"language-ts"}},[a("code",[a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("ASC_NO_ASSERT")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("bool")]),t._v("\n")])])]),a("p",[t._v("Whether "),a("code",[t._v("--noAssert")]),t._v(" has been set.")])]),t._v(" "),a("li",[a("div",{staticClass:"language-ts extra-class"},[a("pre",{pre:!0,attrs:{class:"language-ts"}},[a("code",[a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("ASC_MEMORY_BASE")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("usize")]),t._v("\n")])])]),a("p",[t._v("The value of "),a("code",[t._v("--memoryBase")]),t._v(".")])]),t._v(" "),a("li",[a("div",{staticClass:"language-ts extra-class"},[a("pre",{pre:!0,attrs:{class:"language-ts"}},[a("code",[a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("ASC_OPTIMIZE_LEVEL")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("i32")]),t._v("\n")])])]),a("p",[t._v("The value of "),a("code",[t._v("--optimizeLevel")]),t._v(". Possible values are 0, 1, 2 and 3.")])]),t._v(" "),a("li",[a("div",{staticClass:"language-ts extra-class"},[a("pre",{pre:!0,attrs:{class:"language-ts"}},[a("code",[a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("ASC_SHRINK_LEVEL")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("i32")]),t._v("\n")])])]),a("p",[t._v("The value of "),a("code",[t._v("--shrinkLevel")]),t._v(". Possible values are 0, 1 and 2.")])]),t._v(" "),a("li",[a("div",{staticClass:"language-ts extra-class"},[a("pre",{pre:!0,attrs:{class:"language-ts"}},[a("code",[a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("ASC_LOW_MEMORY_LIMIT")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("i32")]),t._v("\n")])])]),a("p",[t._v("The value of "),a("code",[t._v("--lowMemoryLimit")]),t._v(".")])]),t._v(" "),a("li",[a("div",{staticClass:"language-ts extra-class"},[a("pre",{pre:!0,attrs:{class:"language-ts"}},[a("code",[a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("ASC_EXPORT_RUNTIME")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("i32")]),t._v("\n")])])]),a("p",[t._v("Whether "),a("code",[t._v("--exportRuntime")]),t._v(" has been set.")])]),t._v(" "),a("li",[a("div",{staticClass:"language-ts extra-class"},[a("pre",{pre:!0,attrs:{class:"language-ts"}},[a("code",[a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("ASC_FEATURE_SIGN_EXTENSION")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("bool")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("ASC_FEATURE_MUTABLE_GLOBALS")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("bool")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("ASC_FEATURE_NONTRAPPING_F2I")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("bool")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("ASC_FEATURE_BULK_MEMORY")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("bool")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("ASC_FEATURE_SIMD")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("bool")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("ASC_FEATURE_THREADS")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("bool")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("ASC_FEATURE_EXCEPTION_HANDLING")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("bool")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("ASC_FEATURE_TAIL_CALLS")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("bool")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("ASC_FEATURE_REFERENCE_TYPES")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("bool")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("ASC_FEATURE_MULTI_VALUE")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("bool")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("ASC_FEATURE_GC")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("bool")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("ASC_FEATURE_MEMORY64")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("bool")]),t._v("\n")])])]),a("p",[t._v("Whether the respective feature is enabled.")]),t._v(" "),a("p",[t._v("For example, if a library supports SIMD but also wants to provide a fallback when being compiled without SIMD support:")]),t._v(" "),a("div",{staticClass:"language-ts extra-class"},[a("pre",{pre:!0,attrs:{class:"language-ts"}},[a("code",[a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("ASC_FEATURE_SIMD")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// compute with SIMD operations")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("else")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// fallback without SIMD operations")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])])])]),t._v(" "),a("h2",{attrs:{id:"code-annotations"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#code-annotations"}},[t._v("#")]),t._v(" Code annotations")]),t._v(" "),a("p",[t._v("Decorators work more like compiler annotations in AssemblyScript and are evaluated at compile time.")]),t._v(" "),a("table",[a("thead",[a("tr",[a("th",{staticStyle:{"text-align":"left"}},[t._v("Annotation")]),t._v(" "),a("th",{staticStyle:{"text-align":"left"}},[t._v("Description")])])]),t._v(" "),a("tbody",[a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v("@inline")])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Requests inlining of a constant or function.")])]),t._v(" "),a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v("@final")])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Annotates a class as final, that is it cannot be subclassed.")])]),t._v(" "),a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v("@unmanaged")])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Annotates a class as not tracked by GC, effectively becoming a C-like struct.")])]),t._v(" "),a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v("@external")])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Changes the external name of an imported element. "),a("code",[t._v("@external(module, name)")]),t._v(" changes both the module and element name, "),a("code",[t._v("@external(name)")]),t._v(" changes the element name only.")])])])]),t._v(" "),a("p",[t._v("Custom decorators are ignored, unless given meaning by using a "),a("RouterLink",{attrs:{to:"/compiler.html#transforms"}},[t._v("transform")]),t._v(".")],1),t._v(" "),a("p",[t._v("There are a few more built-in decorators that are likely going to change significantly over time, or may even be removed entirely. While useful for standard library implementation currently, it is not recommend to utilize them in custom code since tooling does not recognize them.")]),t._v(" "),a("details",[a("summary",[t._v("Show me anyway")]),t._v(" "),a("table",[a("thead",[a("tr",[a("th",{staticStyle:{"text-align":"left"}},[t._v("Annotation")]),t._v(" "),a("th",{staticStyle:{"text-align":"left"}},[t._v("Description")])])]),t._v(" "),a("tbody",[a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v("@global")])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Registers an element to be part of the global scope.")])]),t._v(" "),a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v("@lazy")])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Requests lazy compilation of a variable. Useful to avoid unnecessary globals.")])]),t._v(" "),a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v("@operator")])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Annotates a method as a binary operator overload. See below.")])]),t._v(" "),a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v("@operator.binary")])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Alias of "),a("code",[t._v("@operator")]),t._v(".")])]),t._v(" "),a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v("@operator.prefix")])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Annotates a method as a unary prefix operator overload.")])]),t._v(" "),a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v("@operator.postfix")])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Annotates a method as a unary postfix operator overload.")])])])]),t._v(" "),a("h3",{attrs:{id:"binary-operator-overloads"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#binary-operator-overloads"}},[t._v("#")]),t._v(" Binary operator overloads")]),t._v(" "),a("div",{staticClass:"language-ts extra-class"},[a("pre",{pre:!0,attrs:{class:"language-ts"}},[a("code",[a("span",{pre:!0,attrs:{class:"token decorator"}},[a("span",{pre:!0,attrs:{class:"token at operator"}},[t._v("@")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("operator")])]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("OP")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("static")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("__op")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("left"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("T")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" right "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("T")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("T")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token decorator"}},[a("span",{pre:!0,attrs:{class:"token at operator"}},[t._v("@")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("operator")])]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("OP")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("__op")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("right"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("T")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("T")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),a("table",[a("thead",[a("tr",[a("th",{staticStyle:{"text-align":"left"}},[t._v("OP")]),t._v(" "),a("th",{staticStyle:{"text-align":"left"}},[t._v("Description")])])]),t._v(" "),a("tbody",[a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v('"[]"')])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Checked indexed get")])]),t._v(" "),a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v('"[]="')])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Checked indexed set")])]),t._v(" "),a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v('"{}"')])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Unchecked indexed get")])]),t._v(" "),a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v('"{}="')])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Unchecked indexed set")])]),t._v(" "),a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v('"=="')])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Equality (also applies on "),a("code",[t._v("===")]),t._v(")")])]),t._v(" "),a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v('"!="')])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Inequality (also applies on "),a("code",[t._v("!==")]),t._v(")")])]),t._v(" "),a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v('">"')])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Greater than")])]),t._v(" "),a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v('">="')])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Greater than or equal")])]),t._v(" "),a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v('"<"')])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Less than")])]),t._v(" "),a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v('"<="')])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Less than or equal")])]),t._v(" "),a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v('">>"')])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Arithmetic right shift")])]),t._v(" "),a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v('">>>"')])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Logical right shift")])]),t._v(" "),a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v('"<<"')])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Left shift")])]),t._v(" "),a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v('"&"')])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Bitwise AND")])]),t._v(" "),a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v('"|"')])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Bitwise OR")])]),t._v(" "),a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v('"^"')])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Bitwise XOR")])]),t._v(" "),a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v('"+"')])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Addition")])]),t._v(" "),a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v('"-"')])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Subtraction")])]),t._v(" "),a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v('"*"')])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Multiplication")])]),t._v(" "),a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v('"/"')])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Division")])]),t._v(" "),a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v('"**"')])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Exponentiation")])]),t._v(" "),a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v('"%"')])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Remainder")])])])]),t._v(" "),a("h3",{attrs:{id:"unary-operator-overloads"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#unary-operator-overloads"}},[t._v("#")]),t._v(" Unary operator overloads")]),t._v(" "),a("div",{staticClass:"language-ts extra-class"},[a("pre",{pre:!0,attrs:{class:"language-ts"}},[a("code",[a("span",{pre:!0,attrs:{class:"token decorator"}},[a("span",{pre:!0,attrs:{class:"token at operator"}},[t._v("@")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("operator")])]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("prefix")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("OP")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("static")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("__op")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("self"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("T")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("T")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token decorator"}},[a("span",{pre:!0,attrs:{class:"token at operator"}},[t._v("@")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("operator")])]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("prefix")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("OP")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("__op")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("T")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),a("table",[a("thead",[a("tr",[a("th",{staticStyle:{"text-align":"left"}},[t._v("OP")]),t._v(" "),a("th",{staticStyle:{"text-align":"left"}},[t._v("Description")]),t._v(" "),a("th",{staticStyle:{"text-align":"left"}},[t._v("Notes")])])]),t._v(" "),a("tbody",[a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v('"!"')])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Logical NOT")]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}})]),t._v(" "),a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v('"~"')])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Bitwise NOT")]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}})]),t._v(" "),a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v('"+"')])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Unary plus")]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}})]),t._v(" "),a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v('"-"')])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Unary negation")]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}})]),t._v(" "),a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v('"++"')])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Prefix increment")]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Instance overload reassigns")])]),t._v(" "),a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v('"--"')])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Prefix decrement")]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Instance overload reassigns")])])])]),t._v(" "),a("p",[t._v("Note that increment and decrement overloads can have slightly different semantics. If the overload is declared as an instance method, on "),a("code",[t._v("++a")]),t._v(" the compiler does emit code that reassigns the resulting value to "),a("code",[t._v("a")]),t._v(" while if the overload is declared static, the overload behaves like any other overload, skipping the otherwise implicit assignment.")]),t._v(" "),a("h3",{attrs:{id:"unary-postfix-operations"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#unary-postfix-operations"}},[t._v("#")]),t._v(" Unary postfix operations")]),t._v(" "),a("div",{staticClass:"language-ts extra-class"},[a("pre",{pre:!0,attrs:{class:"language-ts"}},[a("code",[a("span",{pre:!0,attrs:{class:"token decorator"}},[a("span",{pre:!0,attrs:{class:"token at operator"}},[t._v("@")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("operator")])]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("postfix")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("OP")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("static")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("__op")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("self"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("T")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("T")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token decorator"}},[a("span",{pre:!0,attrs:{class:"token at operator"}},[t._v("@")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("operator")])]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("postfix")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("OP")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("__op")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token constant"}},[t._v("T")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),a("table",[a("thead",[a("tr",[a("th",{staticStyle:{"text-align":"left"}},[t._v("OP")]),t._v(" "),a("th",{staticStyle:{"text-align":"left"}},[t._v("Description")]),t._v(" "),a("th",{staticStyle:{"text-align":"left"}},[t._v("Notes")])])]),t._v(" "),a("tbody",[a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v('"++"')])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Postfix increment")]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Instance overload reassigns")])]),t._v(" "),a("tr",[a("td",{staticStyle:{"text-align":"left"}},[a("code",[t._v('"--"')])]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Postfix decrement")]),t._v(" "),a("td",{staticStyle:{"text-align":"left"}},[t._v("Instance overload reassigns")])])])]),t._v(" "),a("p",[t._v("Overloaded postfix operations do not preserve the original value automatically.")])])])}),[],!1,null,null,null);s.default=n.exports}}]);
\ No newline at end of file
diff --git a/assets/js/24.ee2d454f.js b/assets/js/24.ee2d454f.js
new file mode 100644
index 000000000..6a5800ebe
--- /dev/null
+++ b/assets/js/24.ee2d454f.js
@@ -0,0 +1 @@
+(window.webpackJsonp=window.webpackJsonp||[]).push([[24],{226:function(t,e,n){"use strict";n.r(e);var a=n(6),r=Object(a.a)({},(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[n("h1",{attrs:{id:"editor-test"}},[n("a",{staticClass:"header-anchor",attrs:{href:"#editor-test"}},[t._v("#")]),t._v(" Editor Test")]),t._v(" "),n("p",[t._v("Text before")]),t._v(" "),n("div",{staticClass:"language-editor extra-class"},[n("pre",{pre:!0,attrs:{class:"language-text"}},[n("code",[t._v('#!runtime=stub\n// Editor A\n\nexport function add(a: i32, b: i32): i32 {\n return a + b\n}\n\nexport function sub(a: i32, b: i32): i32 {\n return a - b\n}\n\n#!html\n
+