This file contains hidden or 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
| //ES5 | |
| var _get = function(){ | |
| var res = arguments[0]; | |
| for(var i = 1;i < arguments.length;i++){ | |
| res = res[arguments[i]]; | |
| if(!res){ | |
| break; | |
| } | |
| } | |
| return res; |
This file contains hidden or 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
| chrome.downloads.onChanged.addListener((delta) => { | |
| if((delta.canResume || {}).current === true | |
| && (delta.error || {}).current === chrome.downloads.InterruptReason.NETWORK_FAILED){ | |
| chrome.downloads.resume(delta.id); | |
| } | |
| }); |
This file contains hidden or 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
| /** | |
| * 配列やCollecitonにタスクを溜めてって一気に流すようなことができるんじゃないかと思ってやってみた。 | |
| * 使いどころが微妙で、parallelの恩恵があまりないかもしれないが... | |
| */ | |
| import java.util.Arrays | |
| import kotlin.streams.toList | |
| fun Array<() -> Any?>.runAll(byParallel: Boolean = true): Array<Any?> { | |
| return if (byParallel) { | |
| Arrays.stream(this).parallel().map { it() }.toArray() |
This file contains hidden or 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
| const sleep = (ms) => { | |
| return new Promise((rslv) => { | |
| setTimeout(() => rslv(), ms); | |
| }); | |
| } | |
| const sleep2 = (ms) => new Promise(rslv => setTimeout(rslv, ms)); | |
| (async () => { | |
| console.log("hello"); |