| 
									
										
										
										
											2020-04-26 01:24:53 +08:00
										 |  |  | This is a simple example that shows the usage of WebAssembly. | 
					
						
							| 
									
										
										
										
											2017-10-30 20:56:57 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-04 20:15:08 +08:00
										 |  |  | WebAssembly modules can be imported like other async modules with `import` or `import()`. | 
					
						
							| 
									
										
										
										
											2020-04-29 04:30:56 +08:00
										 |  |  | When importing, they are downloaded and instantiated in a streaming way. | 
					
						
							| 
									
										
										
										
											2017-10-30 20:56:57 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | # example.js
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-05 05:04:47 +08:00
										 |  |  | ```javascript | 
					
						
							|  |  |  | _{{example.js}}_ | 
					
						
							| 
									
										
										
										
											2017-10-30 20:56:57 +08:00
										 |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # math.js
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-05 05:04:47 +08:00
										 |  |  | ```javascript | 
					
						
							|  |  |  | _{{math.js}}_ | 
					
						
							| 
									
										
										
										
											2017-10-30 20:56:57 +08:00
										 |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-05 04:39:29 +08:00
										 |  |  | # dist/output.js
 | 
					
						
							| 
									
										
										
										
											2017-10-30 20:56:57 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-05 05:04:47 +08:00
										 |  |  | ```javascript | 
					
						
							|  |  |  | _{{dist/output.js}}_ | 
					
						
							| 
									
										
										
										
											2017-10-30 20:56:57 +08:00
										 |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Info
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-14 17:09:09 +08:00
										 |  |  | ## Unoptimized
 | 
					
						
							| 
									
										
										
										
											2017-10-30 20:56:57 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | ``` | 
					
						
							| 
									
										
										
										
											2019-04-05 05:04:47 +08:00
										 |  |  | _{{stdout}}_ | 
					
						
							| 
									
										
										
										
											2017-10-30 20:56:57 +08:00
										 |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-14 17:09:09 +08:00
										 |  |  | ## Production mode
 | 
					
						
							| 
									
										
										
										
											2017-10-30 20:56:57 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | ``` | 
					
						
							| 
									
										
										
										
											2019-04-05 05:04:47 +08:00
										 |  |  | _{{production:stdout}}_ | 
					
						
							| 
									
										
										
										
											2017-10-30 20:56:57 +08:00
										 |  |  | ``` |