首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
您找到你想要的搜索结果了吗?
是的
没有找到

WebViewJavaScriptBridge深入剖析

前一篇文章中,我们大致的讲述了一下JavaScriptCore这个库在iOS开发中的应用。在文中最后的阶段,我们提到了WebViewJavaScriptBridge这个库。提到这个库,可能有一些人就要说了,现在都什么时代了,谁还会用这个库啊?全是坑!不错,早在三年前,这个库有过一段辉煌的时光,在苹果除了WKWebView之后,渐渐的使用这个库的人越来越少,尽管这个库也是支持了WKWebView的。 但是一个事物的存在就有他的价值,就算使用也不是那么频繁了,尽管他有很多的坑。但是对于一个开发者来说,我们应该取其精华去其糟粕,现如今出的很多的交互的bridge依旧是有部分交互逻辑沿用了WebViewJavaScriptBridge的思想。 这里就不得不提味精大神的一片文章,这篇文章里面深入浅出的谈了谈现如今Hybrid开发时常用的一些桥方法。有兴趣的可以去关注一下。废话不多说,那么我们今天就从源码开始解析这个库的使用以及原理。

02

Planetary.js 旋转地球插件

(function() { var canvas = document.getElementById('quakeCanvas'); // Create our Planetary.js planet and set some initial values; // we use several custom plugins, defined at the bottom of the file var planet = planetaryjs.planet(); planet.loadPlugin(autocenter({extraHeight: -120})); planet.loadPlugin(autoscale({extraHeight: -120})); planet.loadPlugin(planetaryjs.plugins.earth({ topojson: { file: 'https://101.43.39.125/HexoFiles/js/planetaryjs/world-110m.json' }, oceans: { fill: '#001320' }, land: { fill: '#06304e' }, borders: { stroke: '#001320' } })); planet.loadPlugin(planetaryjs.plugins.pings()); planet.loadPlugin(planetaryjs.plugins.zoom({ scaleExtent: [50, 5000] })); planet.loadPlugin(planetaryjs.plugins.drag({ onDragStart: function() { this.plugins.autorotate.pause(); }, onDragEnd: function() { this.plugins.autorotate.resume(); } })); planet.loadPlugin(autorotate(5)); planet.projection.rotate([100, -10, 0]); planet.draw(canvas); // Plugin to resize the canvas to fill the window and to // automatically center the planet when the window size changes function autocenter(options) { options = options || {}; var needsCentering = false; var globe = null; var resize = function() { var width = window.outerWidth /2 + (options.extraWidth || 0); var height = window.outerHeight/2 + (options.extraHeight || 0); globe.canvas.width = width; globe.canvas.height = height; globe.projection.translate([width / 2, height / 2]); }; return function(planet) { globe = planet; planet.onInit(function() { needsCentering = true; d3.select(window).on('resize', function() { needsCentering = true; }); }); planet.onDraw(function() { if (needsCentering) { resize(); needsCentering = false; } }); }; }; // Plugin to automatically scale the planet's projection based // on the window size when the planet is initia

03

Install Jumpserver42

Copying '/opt/jumpserver/apps/static/js/plugins/inputTags.jquery.min.js' Copying '/opt/jumpserver/apps/static/js/plugins/cropper/cropper.min.js' Copying '/opt/jumpserver/apps/static/js/plugins/datatables/datatables.min.js' Copying '/opt/jumpserver/apps/static/js/plugins/datatables/pdfmake.min.js.map' Copying '/opt/jumpserver/apps/static/js/plugins/datatables/i18n/English.lang' Copying '/opt/jumpserver/apps/static/js/plugins/datatables/i18n/zh-hans.json' Copying '/opt/jumpserver/apps/static/js/plugins/datepicker/bootstrap-datepicker.js' Copying '/opt/jumpserver/apps/static/js/plugins/demo/peity-demo.js' Copying '/opt/jumpserver/apps/static/js/plugins/dropzone/dropzone.js' Copying '/opt/jumpserver/apps/static/js/plugins/echarts/echarts-all.js' Copying '/opt/jumpserver/apps/static/js/plugins/echarts/echarts.js' Copying '/opt/jumpserver/apps/static/js/plugins/echarts/chart/bar.js' Copying '/opt/jumpserver/apps/static/js/plugins/echarts/chart/chord.js' Copying '/opt/jumpserver/apps/static/js/plugins/echarts/chart/eventRiver.js' Copying '/opt/jumpserver/apps/static/js/plugins/echarts/chart/force.js' Copying '/opt/jumpserver/apps/static/js/plugins/echarts/chart/funnel.js' Copying '/opt/jumpserver/apps/static/js/plugins/echarts/chart/gauge.js' Copying '/opt/jumpserver/apps/static/js/plugins/echarts/chart/heatmap.js' Copying '/opt/jumpserver/apps/static/js/plugins/echarts/chart/k.js' Copying '/opt/jumpserver/apps/static/js/plugins/echarts/chart/line.js' Copying '/opt/jumpserver/apps/static/js/plugins/echarts/chart/map.js' Copying '/opt/jumpserver/apps/static/js/plugins/echarts/chart/pie.js' Copying '/opt/jumpserver/apps/static/js/plugins/echarts/chart/radar.js' Copying '/opt/jumpserver/apps/static/js/plugins/echarts/chart/scatter.js' Copying '/opt/jumpserver/apps/static/js/plugins/echarts/chart/tree.js' Copying '/opt/jumpserver/apps/static/js/plugins/echarts/chart/treemap.js' Copying '/opt/jumpserver/apps/static/js/plugins/echarts/chart/venn.js' Copying '/opt/jumpserver/apps/static/js/plugins/echarts/chart/wordCloud.js' C

02
领券