weex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acton...@apache.org
Subject incubator-weex git commit: + [ios] add feature b to a
Date Thu, 04 May 2017 08:43:32 GMT
Repository: incubator-weex
Updated Branches:
  refs/heads/0.13-dev 2aafe9d95 -> 71dbb5b23


+ [ios] add feature b to a


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/71dbb5b2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/71dbb5b2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/71dbb5b2

Branch: refs/heads/0.13-dev
Commit: 71dbb5b234380039e64ef8f989b8ab99e33a3d18
Parents: 2aafe9d
Author: 齐山 <sunjjbobo@163.com>
Authored: Thu May 4 16:06:49 2017 +0800
Committer: 齐山 <sunjjbobo@163.com>
Committed: Thu May 4 16:06:49 2017 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/71dbb5b2/ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m b/ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m
index 7071e1f..1cd52ee 100644
--- a/ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m
+++ b/ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m
@@ -90,6 +90,20 @@
             [weakSelf triggerClearTimeout:[ret toString]];
         };
         
+        _jsContext[@"btoa"] = ^(JSValue *value ) {
+            NSData *nsdata = [[value toString]
+                              dataUsingEncoding:NSUTF8StringEncoding];
+            NSString *base64Encoded = [nsdata base64EncodedStringWithOptions:0];
+            return base64Encoded;
+        };
+        _jsContext[@"atob"] = ^(JSValue *value ) {
+            NSData *nsdataFromBase64String = [[NSData alloc]
+                                              initWithBase64EncodedString:[value toString]
options:0];
+            NSString *base64Decoded = [[NSString alloc]
+                                       initWithData:nsdataFromBase64String encoding:NSUTF8StringEncoding];
+            return base64Decoded;
+        };
+        
         _jsContext[@"nativeLog"] = ^() {
             static NSDictionary *levelMap;
             static dispatch_once_t onceToken;


Mime
View raw message