- 
                Notifications
    
You must be signed in to change notification settings  - Fork 341
 
Open
Description
Hello, I'm trying to use the olcs_tileLoadFunction function but I cant find an example and I can't get it working. This is what I do:
 source.set('olcs_tileLoadFunction', (tile, src) => { loadFunction(tile, src) })
export function loadFunction(tile, src) { const xhr = new XMLHttpRequest(); xhr.responseType = 'blob'; xhr.addEventListener('loadend', function () { const data = this.response; if (data !== undefined) { tile.getImage().src = URL.createObjectURL(data); } else { tile.setState(TileState.ERROR); } }); xhr.addEventListener('error', function () { tile.setState(TileState.ERROR); }); xhr.open('GET', src); if(getToken() !== undefined) { xhr.setRequestHeader("Authorization", getToken()); } xhr.send(); }
What am I doing wrong?
Metadata
Metadata
Assignees
Labels
No labels