ionic.js
开篇写博客,可能表述无无序,持续改进中。
一、开头定义全局变量ionic:
window.ionic = window.ionic || {};
window.ionic.view = {};
window.ionic.version = '1.2.4';
二、定义:ionic.DelegateService
传参为method,处理了如下事情:
判断方法名称不为$getByHandle
function trueFn() { return true; } //mark ,这句话不知道为啥这么写
返回一个方法,该方法最终返回DelegateService的一个实例对象,方法里默认传入参数$log, 不知道哪里来的,暂且认为是angular里面的变量。
三、定义:ionic.DomUtil
在domUtils下扩展如下方法:
requestAnimationFrame:处理浏览器兼容后的requestAnimationFrame
cancelAnimationFrame:处理浏览器兼容后cancelAnimationFrame
animationFrameThrottle : 暂时未理解,注释里这么描述的
When given a callback, if that callback is called 100 times between animation frames, adding Throttle will make it only run the last of the 100 calls.
contains:类似于jquery的contains的功能
getPositionInParent : 类似于jquery的position()的功能
getOffsetTop : 类似于jquery的offset()的功能
ready:自认为该方法比jquery的domready好用,判断domReady了,则直接调用requestAnimationFrame方法,否则就往readyCallbacks数组里push进去。
getTextBounds : 目前解释不出来
getChildIndex :类似于jquery的index()
getParentWithClass : 查找当前元素的指定class的父亲,最多只往上找10级。
getParentOrSelfWithClass:名字取的不错
rectContains :判断一个点是否在一个rect里
blurAll :取消所有的聚焦
cachedAttr: 目前不理解为什么可以这样取值
cachedStyles :同上
本文介绍了Ionic框架中全局变量的定义及版本说明,并详细解析了DelegateService的工作原理及其参数处理过程。同时深入探讨了DomUtil提供的多种实用功能,如requestAnimationFrame、cancelAnimationFrame等方法的实现与兼容性处理。
966

被折叠的 条评论
为什么被折叠?



