- JSエンジンで事前コンパイルを行うためのJSサブセットの仕様
- 書き方を工夫することによって型情報を与えたり、TypedArrayをメモリとして使ったり
- 主に機械的にJSにコンパイルする何かを対象としている
- もちろん、手でも書ける(大規模なのは現実的には無理かも)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Promise | |
@STATE_PENDING = 2 | |
@STATE_RESOLVED = 1 | |
@STATE_REJECTED = 0 | |
constructor: -> | |
@_onResolved = null | |
@_onRejected = null | |
@_next = null | |
@_state = Promise.STATE_PENDING |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>fileio</title> | |
</head> | |
<body> | |
<input type="file"> | |
<script src="file.js"></script> | |
<script> | |
window.onload = function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aaaaa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fact(n) { | |
var d = $.Deferred(); | |
setTimeout(function() { | |
function onResolved(result) { | |
d.resolve(result * n); | |
} | |
n > 1 ? fact(n - 1).then(onResolved) : d.resolve(n); | |
}, 100); | |
return d.promise(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
waitForAsyncProcesses().done(finishedCallback); | |
function waitForAsyncProcesses() { | |
var asyncFunc, A, B, C, D; | |
asyncFunc = function(ms) { | |
var dfd = $.Deferred(); | |
setTimeout(dfd.resolve, ms); | |
return dfd.promise(); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#checkbox').val(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<snippet> | |
<content><![CDATA[ | |
The MIT License | |
Copyright (c) ${1:year} ${2:author} <${3:hoge}@${4:gmail.com}> | |
Permission is hereby granted, free of charge, to any person obtaining a copy of | |
this software and associated documentation files (the "Software"), to deal in | |
the Software without restriction, including without limitation the rights to | |
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern class ArrayBuffer | |
{ | |
public function new(byteLength:Int):Void; | |
public var byteLength(default, null):Int; | |
public function slice(begin:Int, ?end:Int):ArrayBuffer; | |
} | |
extern private class ArrayBufferView | |
{ | |
public var buffer(default, null):ArrayBuffer; |