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
sealed class Result<out T> { | |
object Idle : Result<Nothing>() | |
object Loading : Result<Nothing>() | |
data class Error(val error: Throwable) : Result<Nothing>() | |
data class Success<T>(val data: T) : Result<T>() | |
} |
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
function makeRegex() { | |
var argsArray = Array.prototype.slice.call(arguments); | |
return new RegExp(argsArray.map(function (r) { | |
return r.source | |
}).join('')); | |
} |
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
// async script loading a la souders | |
TWHIST.loadScript = function(url, onload) { | |
var domscript = TWHIST.window.document.createElement('script'); | |
domscript.src = url; | |
if ( onload ) { | |
domscript.onloadDone = false; | |
domscript.onload = function() { | |
if ( !domscript.onloadDone ) { | |
domscript.onloadDone = true; |