Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions CordovaLib/Classes/Public/CDVCommandQueue.m
Original file line number Diff line number Diff line change
Expand Up @@ -91,23 +91,6 @@ - (void)enqueueCommandBatch:(NSString*)batchJSON
}
}

- (void)fetchCommandsFromJs
{
__weak CDVCommandQueue* weakSelf = self;
NSString* js = @"cordova.require('cordova/exec').nativeFetchMessages()";

[_viewController.webViewEngine evaluateJavaScript:js
completionHandler:^(id obj, NSError* error) {
if ((error == nil) && [obj isKindOfClass:[NSString class]]) {
NSString* queuedCommandsJSON = (NSString*)obj;
CDV_EXEC_LOG(@"Exec: Flushed JS->native queue (hadCommands=%d).", [queuedCommandsJSON length] > 0);
[weakSelf enqueueCommandBatch:queuedCommandsJSON];
// this has to be called here now, because fetchCommandsFromJs is now async (previously: synchronous)
[self executePending];
}
}];
}

- (void)executePending
{
// Make us re-entrant-safe.
Expand Down
1 change: 0 additions & 1 deletion CordovaLib/include/Cordova/CDVCommandQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
- (void)resetRequestId;
- (void)enqueueCommandBatch:(NSString*)batchJSON;

- (void)fetchCommandsFromJs;
- (void)executePending;
- (BOOL)execute:(CDVInvokedUrlCommand*)command;

Expand Down
6 changes: 1 addition & 5 deletions cordova-js-src/exec.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,18 +134,14 @@ iOSExec.nativeEvalAndFetch = function (func) {

function cordovaExec () {
var cexec = require('cordova/exec');
var cexec_valid = (typeof cexec.nativeFetchMessages === 'function') && (typeof cexec.nativeEvalAndFetch === 'function') && (typeof cexec.nativeCallback === 'function');
var cexec_valid = (typeof cexec.nativeEvalAndFetch === 'function') && (typeof cexec.nativeCallback === 'function');
return (cexec_valid && execProxy !== cexec) ? cexec : iOSExec;
}

function execProxy () {
cordovaExec().apply(null, arguments);
}

execProxy.nativeFetchMessages = function () {
return cordovaExec().nativeFetchMessages.apply(null, arguments);
};

execProxy.nativeEvalAndFetch = function () {
return cordovaExec().nativeEvalAndFetch.apply(null, arguments);
};
Expand Down
Loading