Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

+ [ios]support bota and atob #315

Merged
merged 1 commit into from
May 4, 2017
Merged

Conversation

kfeagle
Copy link
Contributor

@kfeagle kfeagle commented May 4, 2017

  • support bota and atob
  • demo
<template>
  <div id="test" style="" onlongpress="longpress" onclick="click">

    <text id="canvas_demo" style="backgroundColor:yellow;width:750;height:100;">demo 1</text>

    <text if="{{shown}}" style="width:750;height:100;">{{original}}</text>
    <text if="{{shown}}" style="width:750;height:100;">{{encode}}</text>
    <text if="{{shown}}" style="width:750;height:100;">{{decode}}</text>


    <text id="canvas_demo2" style="backgroundColor:yellow;width:750;height:100;">demo 2</text>


  </div>
</template>
<script>
  console.log("[index.we::script] start...");



  module.exports = {
    data: {
      shown: true,
      original: '',
      encode: '',
      decode: ''
    },
    methods: {
      longpress: function(e) {
        console.log('long:', e);
      },
      click: function(e) {
        //runNextCase();
      },
      disable: function() {
        disableGcanvas();
      }

    },

    created: function() {


    },
    ready: function() {

      //leonTest();


      console.log("base64 >>> ready() ");

      //input编码后输出应该是 YWxpYmFiYSB0YW9iYW8gd2VleA==
      var input = "alibaba taobao weex";

      var input2 = "";

      //for (var k = 0 ; k < 1000 * 1000 * 10; k++){
      for (var k = 0; k < 1000 * 1000; k++) {
        input2 += "abcdefghijklmnopqrstuvwxyz"
      }

      var encode_str, decode_str;



      console.log("base64 >>> encode_str");
      this.original = "原始字符串: " + input;
      encode_str = btoa(input);
      decode_str = atob(encode_str);

      this.encode = "编码后: " +  encode_str;
      this.decode = "解码后: " + decode_str;
      console.log("base64 encode_str: " + encode_str);
      console.log("base64 decode_str: " + decode_str);



      var time1 = new Date().getTime();
      var time2;


      encode_str = btoa(input2);

      time2 = new Date().getTime();

      console.log("base64 encode a very long string, time cost: " + (time2 - time1));




    },


    destroyed: function() {


      //clearInterval(timer1);
      //clearInterval(timer2);
      console.log('在页面被销毁时调用 222222222');
      //disable();
    }

  }
</script>

@weex-bot
Copy link

weex-bot commented May 4, 2017

1 Message
📖 Executed 53 tests, with 0 failures (0 unexpected) in 89.793 (89.868) seconds

Generated by 🚫 danger

@asfgit asfgit merged commit 71dbb5b into apache:0.13-dev May 4, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants