How to deal with broken/undefined JsApi