Giter VIP home page Giter VIP logo

api_ext's Introduction

!!!THIS REPO IS NOT MAINTAINED!!!

api_ext

APICloud API 进行规范和扩展。 所有的扩展功能不能在apiready运行前使用,但可以在运行中或运行后使用。

pro文件夹中是发布版本。

如何使用

将js文件引入到页面的任意位置。

内容

$api

$api.objectToJson = $api.jsonToStr

$api.jsonToObject = $api.strToJson

$api.addEvent = $api.addEvt

$api.removeEvent = $api.rmEvt

$api.attribute = $api.attr

$api.addClass = $api.addCls

$api.removeClass = $api.removeCls

$api.hasClass = $api.hasCls

$api.toggleClass = $api.toggleCls

$api.value = $api.val

$api.cssValue = $api.cssVal

$api.removeStorage = $api.rmStorage

$api.previous = $api.prev

$api.equals = $api.eq

$api.getRectOf(ELEMENT)

获取元素的offset并转换为x,y,w,h的形式。

api

暂无。

global

alert()

支持传入对象,支持传入多个参数

console.log()

支持传入对象,支持传入多个参数

api_ext

parseUIModule

通过HTML创建UIModule。

<script>
apiready = function(){
	api_ext.parseUIModule();//或 api_ext.parseUIModule('UIModule/UIInput');    不传参数解析所有支持的UIModule,传递参数解析指定type的UIModule
}
</script>

使用ui-module标签,type传递支持的类型,具体用法见下文。

UIModule/UIInput
<body>
	<ui-module type="UIModule/UIInput" data-open-param="{
	    rect: $api.getRectOf(this),
	    fixedOn: api.frameName,
	    styles:{bgColor:'#aaa'}
	}" data-open-callback="fnUIInputOpenCallback">
	这里是UIInput
	</ui-module>
</body>

<script>
	function fnUIInputOpenCallback(ret){
		//....
	}
</script>

使用ui-module标签,typeUIModule/UIInputdata-open-paramUIInput.open()的第一个参数,data-open-callback是全局的回调函数。

data-open-param支持通过this获取当前HTML元素。

registerCustomerApiExt(yourExtFn)

对api对象注册你自己的扩展功能。

api_ext.registerCustomerApiExt(function(aim){
  aim.yourExtension = function(){...}
})

registerCustomer$ApiExt(yourExtFn)

对$api对象注册你自己的扩展功能。

api_ext.registerCustomer$ApiExt(function(aim){
  aim.yourExtension = function(){...}
})

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.