//http://jspatch.com/
//http://www.jspatch.com/Tools/convertor
//https://github.com/bang590/JSPatch
//https://github.com/bang590/JSPatchConvertor
//https://github.com/bang590/JSPatchX
//https://github.com/hw-1/Alcatraz-Xcode8
//要所有都接入以防出现没有接入的。到时候功能上支持不了。
//pod 'JSPatch'
//pod 'JSPatch/Extensions'
//pod 'JSPatch/JPCFunction'
1.jspatch Function statements must have a name
js文件代码defineClass前面不要出现注释代码
//1.NSNumber失败
//解决方案https://github.com/bang590/JSPatch/wiki/JPNumber%E4%BD%BF%E7%94%A8%E6%96%87%E6%A1%A3
// var num1 = NSNumber.alloc().initWithLong(1);
//2.OC: [self handleEarnCoins_loginSuccess];JS : self.handleEarnCoins_loginSuccess();调用失败
//解决方案https://github.com/bang590/JSPatch/wiki/JSPatch-%E5%9F%BA%E7%A1%80%E7%94%A8%E6%B3%95
//若原OC方法名里包含下划线_,在JS使用双下划线__代替:
//3.block调用失败
/*[FHWAppDelegate showLoginViewWithBlock:self loginSource:@"签到赚积分页" animated:YESloginSucessBlock:^{
[self handleEarnCoins_loginSuccess];
}];
FHWAppDelegate.showLoginViewWithBlock_loginSource_animated_loginSucessBlock(self, "签到赚积分页", YES,
block("void", function()
{
self.handleEarnCoins__loginSuccess();
}));
*/
/*正确的姿势
var weakSelf = __weak(self);
FHWAppDelegate.showLoginViewWithBlock_loginSource_animated_loginSucessBlock(self, "签到赚积分页", YES,
block("void", function()
{
weakSelf.handleEarnCoins__loginSuccess();
}));
*/
//4.
require('JPEngine').addExtensions(['JPNumber'])
require("MobClick, UMSAgent, NSMutableArray, NSNumber, FHWAppDelegate");
defineClass("FHWWorthBuyViewController", {
handleSignButtonTaped:function(sender)
{
MobClick.event("home_qd");
UMSAgent.postEvent("home_signin");
vararray = NSMutableArray.alloc().initWithCapacity(10);
varnum1 = toOCNumber(2.14)
array.addObject(num1);
varnum2 = array.objectAtIndex(0);
if(FHWAppDelegate.needLogin())
{
console.log("没有登录了");
varweakSelf = __weak(self);
FHWAppDelegate.showLoginViewWithBlock_loginSource_animated_loginSucessBlock(self,"签到赚积分页", YES,
block("void",function()
{
weakSelf.handleEarnCoins__loginSuccess();
}));
}else
{
console.log("已经登录了");
self.handleEarnCoins__loginSuccess();
}
}
},
{});