bang590 / jspatchconvertor Goto Github PK
View Code? Open in Web Editor NEWJSPatch Convertor is a tool that converts Objective-C code to JSPatch script automatically.
License: MIT License
JSPatch Convertor is a tool that converts Objective-C code to JSPatch script automatically.
License: MIT License
Are there any plans to implement the convertor as a plugin for either Sublime or Atom?
self.view.layer.contents = (__bridge id)[UIImage imageNamed:@"gougou.jpg"].CGImage;
About top code ,how can I deal with the situation
I download the project,and open the index.html through Safari, it's OK. But using Chrome, I couldn't open it. Only showing loading...
对于 example 来说
@implementation SampleClass
+ (void)requestUrl:(NSString *)url param:(NSDictionary *)dict callback:(JPCallback)callback {
[super requestUrl:url param:dict callback:callback];
JPRequest *obj = [[JPRequest alloc] initWithUrl:url param:dict];
obj.successBlock = ^(id data, NSError *err) {
NSString *content = [JPParser parseData:data];
if (callback) callback(@{
@"content": content
}, err);
[self.dataSource refresh];
self.handleRequestSuccess(data);
};
}
@end
输出为
require('JPRequest,JPParser');
defineClass('SampleClass', {} {
requestUrl_param_callback: function(url, dict, callback) {
self.super().requestUrl_param_callback(url, dict, callback);
var obj = JPRequest.alloc().initWithUrl_param(url, dict);
obj.setSuccessBlock(block('id,NSError*', function(data, err) {
var content = JPParser.parseData(data);
if (callback) callback({
"content": content
}, err);
self.dataSource().refresh();
self.handleRequestSuccess()(data);
}));
},
});
defineClass 的参数 应该是 'SampleClass', {}, {}
forappRange.location != NSNotFound
你好,像这个NSNotFound 在jsPatch 中怎么替换啊
JSPatchConvertor可以考虑做成Xcode插件,这样就方便了
类似:https://github.com/dzenbot/XCSwiftr
@implementation ViewController
- (void)loadNewData{
[[NetAPIManager sharedManager] requestWithParam:params andBlock:^(id data, NSError *error) {
if (data) {
if ([data isKindOfClass:[NSDictionary class]]) {
}}
else{
}
}];
}
@end
转换结果为:
require('NetAPIManager,NSDictionary');
defineClass('ViewController', {
loadNewData: function() {
NetAPIManager.sharedManager().requestWithParam_andBlock(params, block('id,NSError*', function(data, error) {
if (data.isKindOfClass(NSDictionary.class())) {}
} else {}
}));
},
});
可以看到if (data){这个if语句丢失了
当遇到
[self loadTemplate:@"/www/html/test-suite.html"];
会编译为
self.loadTemplate("/www/html/test-suite.html()");
[super viewDidLoad];
会转成
super.viewDidLoad();
应该转成
self.super().viewDidLoad();
NSString *str = @"document.javascript"
'.'会被转成() 在字符串中应该被忽略
NSString *actionUrl = [[SomeStore sharedStore].testData stringValueForKey:@"action"];
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.