BBAJSBindingTools.h 878 Bytes
//
//  BBAJSBindingTools.h
//  SWAN
//
//  Created by baidu on 2018/8/2.
//  Copyright © 2018年 baidu. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <JavaScriptCore/JavaScriptCore.h>

#ifdef DEBUG
#define BBAJSBLog(fmt, ...)        NSLog((@"JSLog " fmt), ##__VA_ARGS__)
#define BBAJSBErrorLog(fmt, ...)   NSLog((@"JSLog Error" fmt), ##__VA_ARGS__)
#else
#define BBAJSBLog(...)
#define BBAJSBErrorLog( ...)
#endif

#define BBAJSB_JSStringRefSafeRelease(jsStringRef) do {    \
    if (jsStringRef) { \
        JSStringRelease(jsStringRef);  \
        jsStringRef = NULL;    \
    }   \
} while(0)

#define CHECK_JSVALUE_VALID(value) \
(value && [value isKindOfClass:JSValue.class] && ![value isUndefined] && ![value isNull])

#define CHECK_JSVALUE_INVALID(value) \
(!value || ![value isKindOfClass:JSValue.class] || [value isUndefined] || [value isNull])