async await ( preferably without callbacks )
-
- Posts: 229
- Joined: Sat Mar 01, 2014 3:02 pm
async await ( preferably without callbacks )
Is there a way of doing async await in SB?
Re: async await ( preferably without callbacks )
Code: Select all
Procedure.s HTTPRequestSync(Type, URL.s, Parameters.s = "")
! let type;
! switch (v_type) {
! case 0: type = "GET"; break;
! case 1: type = "POST"; break;
! case 2: type = "PUT"; break;
! case 4: type = "DELETE"; break;
! case 3: type = "PATCH"; break;
! }
! const result = $.ajax({
! url: v_url,
! type: type,
! data: v_parameters,
! async: false,
! dataType: 'json',
! });
! return result.responseText;
EndProcedure
Define Result.s
Debug "Starting"
Result = HTTPRequestSync(#PB_HTTP_Get, #PB_Compiler_Filename)
Debug "Len(Result): " + Str(Len(Result))
Debug "Finished"
-
- Posts: 229
- Joined: Sat Mar 01, 2014 3:02 pm
Re: async await ( preferably without callbacks )
Let's say I want to run a SB app in a PB WebViewGadget that exposes custom PB functions, those would return a promise.