Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
bindingx-performance-test
Advanced tools
$ npm install weex-bindingx --save
import bindingx from 'weex-bindingx';
name | args | returns | description |
---|---|---|---|
prepare | {object} options | {object} | prepare bindingx |
bind | {object} options | {object} | bind an expression |
unbind | {object} options | void | unbind an expression |
unbindAll | void | unbind for all |
findDOMNode(this.refs.block)
findDOMNode(this.refs.block).ref
scroll
,pan
,timing
,orientation
document.id
to get it,you should't pass it in webauto
or pan-x
or pan-y
,default value is auto
10
,it means the panstart
event won't be triggerred until the distance of touchmove >10
10
0.5
, it means the ratio of width/heightimport {createElement, Component, render} from 'rax';
import bindingx from 'weex-bindingx';
import View from 'rax-view';
import {isWeex} from 'universal-env';
function getEl(el){
return isWeex ? findDOMNode(el).ref : findDOMNode(el);
}
class App extends Component {
x = 0;
y = 0;
componentDidMount(){
this.bindEl();
}
onTouchStart(){
this.bindEl();
}
bindEl(){
let blockEl = getEl(this.refs.block);
let token = bindingx.bind({
anchor: blockEl,
eventType: 'pan',
props: [
{
element: blockEl,
property: 'transform.translateX',
expression: `x+${this.x}`
},
{
element: blockEl,
property: 'transform.translateY',
expression: `y+${this.y}`
}]
},(e)=>{
if (e.state === 'end') {
this.x += e.deltaX;
this.y += e.deltaY;
}
});
}
render(){
return (<View onTouchStart={(e) => this.onTouchStart(e)} ref="block" style={{
position: 'absolute',
left: 0,
top: 0,
width: 300,
height: 300,
backgroundColor: 'red'
}}>block</View>)
}
}
render(<App />);
<template>
<scroller class="scroller" >
<div :ref="'box'" class="box" @touchstart="ontouchstart" @appear="onappear"></div>
</scroller>
</template>
<style scoped>
.scroller {
flex: 1;
}
.box {
border-width: 2px;
border-style: solid;
border-color: #BBBBBB;
width: 250px;
height: 250px;
margin-top: 250px;
margin-left: 250px;
background-color: #EEEEEE;
margin-bottom:500px;
}
</style>
<script>
import {isWeex} from 'universal-env';
import bindingx from 'weex-bindingx';
function getEl(el) {
if (typeof el === 'string' || typeof el === 'number') return el;
return isWeex ? el.ref : el instanceof HTMLElement ? el : el.$el;
}
export default {
data () {
return {
x: 0,
y: 0,
flag: 0
}
},
methods: {
onappear () {
this.bind();
},
bind () {
var box = getEl(this.$refs.box);
bindingx.bind({
anchor: box,
eventType: 'pan',
props: [
{
element: box,
property: 'transform.translateX',
expression: {
origin: `x+${this.x}`,
transformed: `{\"type\":\"+\",\"children\":[{\"type\":\"Identifier\",\"value\":\"x\"},{\"type\":\"NumericLiteral\",\"value\":\"${this.x}\"}]}`
}
},
{
element: box,
property: 'transform.translateY',
expression: {
origin: `y+${this.y}`,
transformed: `{\"type\":\"+\",\"children\":[{\"type\":\"Identifier\",\"value\":\"y\"},{\"type\":\"NumericLiteral\",\"value\":\"${this.y}\"}]}`
}
}
]
}, (e) => {
if (e.state === 'end') {
this.x += e.deltaX;
this.y += e.deltaY;
}
});
},
ontouchstart (event) {
this.bind();
}
}
}
</script>
FAQs
bindingx,expression,binding,weex
We found that bindingx-performance-test demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.