//
// JPEngine.h
// JSPatch
//
// Created by bang on 15/4/30.
// Copyright (c) 2015 bang. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <JavaScriptCore/JavaScriptCore.h>
@interface JPEngine : NSObject
/*!
@method
@discussion start the JSPatch engine, execute only once.
*/
+ (void)startEngine;
/*!
@method
@description Evaluate Javascript code from a file Path. Call it after +startEngine.
@param filePath: The filePath of the Javascript code.
@result The last value generated by the script.
*/
+ (JSValue *)evaluateScriptWithPath:(NSString *)filePath;
/*!
@method
@description Evaluate a string of JavaScript code. Call it after +startEngine.
The method will generate a default resouceURL named "main.js" to the Safari debugger.
@param script: A string containing the JavaScript code to evaluate.
@result The last value generated by the script.
*/
+ (JSValue *)evaluateScript:(NSString *)script;
/*!
@method
@description Return the JSPatch JavaScript execution environment.
*/
+ (JSContext *)context;
/*!
@method
@description Add JPExtension.
@param extensions: An array containing class name string.
*/
+ (void)addExtensions:(NSArray *)extensions;
/*!
@method
@description add new struct type supporting to JS
@param defineDict: the definition of struct, for Example:
@{
@"name": @"CGAffineTransform", //struct name
@"types": @"ffffff", //struct types
@"keys": @[@"a", @"b", @"c", @"d", @"tx", @"ty"] //struct keys in JS
}
*/
+ (void)defineStruct:(NSDictionary *)defineDict;
/*!
@method
@description Return the registered struct definition in JSPatch,
the key of dictionary is the struct name.
*/
+ (NSMutableDictionary *)registeredStruct;
@end
@interface JPExtension : NSObject
+ (void)main:(JSContext *)context;
+ (void *)formatPointerJSToOC:(JSValue *)val;
+ (id)formatPointerOCToJS:(void *)pointer;
+ (id)formatJSToOC:(JSValue *)val;
+ (id)formatOCToJS:(id)obj;
+ (int)sizeOfStructTypes:(NSString *)structTypes;
+ (void)getStructDataWidthDict:(void *)structData dict:(NSDictionary *)dict structDefine:(NSDictionary *)structDefine;
+ (NSDictionary *)getDictOfStruct:(void *)structData structDefine:(NSDictionary *)structDefine;
@end
没有合适的资源?快使用搜索试试~ 我知道了~
JSPatch学习笔记-UI基础
共24个文件
m:4个
plist:4个
h:4个
需积分: 10 24 下载量 16 浏览量
2016-01-18
16:56:52
上传
评论
收藏 775KB ZIP 举报
温馨提示
代码中是JSPatch学习笔记的UI基础部分,其中包括以下内容: 1. 项目环境配置 2. 变量 * 局部变量 * 全局变量 * 使用OC中的枚举类型 `Objective-C 里的常量不能直接在 JS 上使用,可以直接在 JS 上用具体值代替,或者在 JS 上重新定义同名的全局变量` 3. 类的扩展 * 重写方法(调用父类方法,需添加`ORIG`关键字) * 覆盖方法 * 添加方法 4. 基础控件 * UIView * UIButton * 点击事件监听 * UILabel * UITextField * 文本框内容改变事件监听 * UIAlertView * 弹框 * 监听按钮点击事件
资源推荐
资源详情
资源评论
收起资源包目录
JSPatch演练-01-UI基础.zip (24个子文件)
01-UI基础
JSPatch演练.xcodeproj
project.xcworkspace
contents.xcworkspacedata 168B
xcuserdata
apple.xcuserdatad
UserInterfaceState.xcuserstate 67KB
project.pbxproj 18KB
xcuserdata
apple.xcuserdatad
xcschemes
xcschememanagement.plist 575B
JSPatch演练.xcscheme 4KB
xcdebugger
Breakpoints_v2.xcbkptlist 473B
JSPatch演练Tests
JSPatch__Tests.m 903B
Info.plist 733B
.DS_Store 6KB
JSPatch演练
JSPatch.framework
JSPatch 1.86MB
.DS_Store 6KB
Headers
JSPatch.h 284B
JPEngine.h 2KB
Info.plist 739B
Assets.xcassets
AppIcon.appiconset
Contents.json 585B
main.m 332B
AppDelegate.h 275B
AppDelegate.m 2KB
Base.lproj
LaunchScreen.storyboard 2KB
Main.storyboard 2KB
main.js 5KB
ViewController.h 213B
Info.plist 1KB
ViewController.m 2KB
共 24 条
- 1
资源评论
chernyog
- 粉丝: 56
- 资源: 28
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功