I'm trying to fix the webaudio package to work with Safari as it exposes 
`webkitAudioContext` instead of `AudioContext`.
    
    
    proc newAudioContext*(): AudioContext {.importjs: "new AudioContext()".}
    
    
    Run

In Javascript you'd generally do something like:
    
    
    var AudioContext = window.AudioContext // Default
        || window.webkitAudioContext // Safari and old versions of Chrome
        || false; // unsupported
    var ctx = null;
    if(AudioContext) {
     ctx = new AudioContext();
    }
    
    
    Run

Is there an idiomatic way of doing this with Nim's JS backend?

Reply via email to