




#import "ACBaseJSPlugin.h"
#import "ACBridgeUtil.h"

@implementation ACBaseJSPlugin

- (id)init
{
    self = [super init];
    if (self) {
        _nativeCalled = YES;
    }
    return self;
}

- (void)respondJSWithMsg:(ACMessage *)resMsg
{
    if (!resMsg) {
        return;
    }
    
    if (self.isNativeCalled) {
        if (self.nativeResponseBlock) {
            self.nativeResponseBlock(resMsg);
        }
    }
    else {
        if (self.webView) {
            // native调用JS，回传返回值
            [ACBridgeUtil webView:self.webView callJsWithMessage:resMsg];
        }
    }
}

@end
