-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Common (cross platform) base for mobile specific API - JS Error reporting back to native land
- Loading branch information
Showing
8 changed files
with
108 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// License information is available from LICENSE file | ||
|
||
package io.jxcore.node; | ||
|
||
import io.jxcore.node.jxcore.JXcoreCallback; | ||
|
||
import java.util.ArrayList; | ||
|
||
import android.annotation.SuppressLint; | ||
import android.util.Log; | ||
|
||
public class JXMobile { | ||
public static void Initialize() { | ||
jxcore.RegisterMethod("OnError", new JXcoreCallback() { | ||
@SuppressLint("NewApi") | ||
@Override | ||
public void Receiver(ArrayList<Object> params, String callbackId) { | ||
String message = (String) params.get(0); | ||
String stack = (String) params.get(1); | ||
|
||
Log.e("jxcore", "Error!: " + message + "\nStack: " + stack); | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// See LICENSE file | ||
|
||
#ifndef JXcordova_JXMobile_h | ||
#define JXcordova_JXMobile_h | ||
|
||
@interface JXMobile : NSObject | ||
{} | ||
+ (void) defineMethods; | ||
@end | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// See LICENSE file | ||
|
||
#import <Foundation/Foundation.h> | ||
#import "JXcore.h" | ||
#import "JXMobile.h" | ||
#import "CDVJXcore.h" | ||
|
||
@implementation JXMobile | ||
{} | ||
|
||
+ (void) defineMethods { | ||
// Listen to Errors on the JS land | ||
[JXcore addNativeBlock:^(NSArray *params, NSString *callbackId) { | ||
NSString *errorMessage = (NSString*)[params objectAtIndex:0]; | ||
NSString *errorStack = (NSString*)[params objectAtIndex:1]; | ||
|
||
NSLog(@"Error!: %@\nStack:%@\n", errorMessage, errorStack); | ||
} withName:@"OnError"]; | ||
} | ||
@end |