JSPatch Convertor is a tool that converts Objective-C code to JSPatch script automatically.
JavaScript ANTLR Other
Latest commit 6b224cf Apr 23, 2016 @bang590 Fix #5
Permalink
Failed to load latest commit information.
css init Oct 8, 2015
img init Oct 8, 2015
js Fix #5 Apr 23, 2016
.gitignore Fix issue #1 #1 Apr 12, 2016
JSPatchConvertor.zip update Mac application. Dec 23, 2015
LICENSE init Oct 8, 2015
README-CN.md
README.md Add Mac Application . Dec 18, 2015
index.html Fix 'super' issue #2 Nov 10, 2015

README.md

JSPatch Convertor

JSPatch Convertor is a tool that converts Objective-C code to JSPatch script automatically.
( What's JSPatch? )

Usage

Check out http://bang590.github.io/JSPatchConvertor

Please use Chrome or Safari.

Advice: You can also download Mac Application:

Click: https://github.com/DevSonw/JSPatchConvertor/blob/gh-pages/JSPatchConvertor.zip

Supported

The Objective-C syntax below is supported to convert:

Method declaration

- (void)requestUrl:(NSString *)url param:(NSDictionary *)dict {}
requestUrl_param: function(url, dict) {}

Method calling

[[JPRequest alloc] initWithUrl:url param:dict];
JPRequest.alloc().initWithUrl_param(url, dict);

Block syntax

[JPRquest handleCallback:^(id data, NSError *err) {}];
JPRquest.handleCallback(block('id,NSError*', function(data, err) {}));

Variable declaration

NSString *str = @"content";
var str = "content";

Getting/Setting Property

self.handler.successBlock(data);
self.handler.data = [[JPData alloc] init];
self.handler().successBlock()(data);
self.handler().setData(JPData.alloc().init());

NSString / NSArray / nil ...

NSDictionary *dict = nil;
dict = @{
     @"arr": @[@(1), @"2"]
};
var dict = null;
dict = {
    "arr": [(1), "2"]
};

Unsupported

JSPatch Convertor didn't support the Objective-C / C syntax below, you should modify it manually after converted:

  • Macro / constant variable / Enum
  • C function calling
  • GCD functions
  • Pointer / Struct
  • Getting / Setting private variable