Check if File Exists?

I found something, that seems on the correct path, but the author also states it is a bit of a hack.

I thought that I can:

BABYLON.Texture.WhenAllReady([texture],  () => this.OnTextureLoaded(texture, blockInShader));

Then in the callback function:

    OnTextureLoaded = function (texture : BABYLON.Texture, textureBlock : BABYLON.TextureBlock)
    {
        if(texture && texture.isReady())
        {
            textureBlock.texture = texture;
        }
    }

It still manages to go inside if, when texture is null.
On top of that I got 404 for every texture (I think).