bindingx-web-polyfill

    0.1.18 • Public • Published

    bindingx-web-polyfill

    Install & Use

    
    import bindingx from 'bindingx-web-polyfill';
    
    var blockEl = document.getElementById('block');
    
    var x = 0;
    
    function bind() {
      bindingx.bind({
        anchor: blockEl,
        eventType: 'pan',
        options: {
          touchAction: 'pan-x'
        },
        props: [
          {
            element: blockEl,
            property: 'transform.translateX',
            expression: {
              transformed: `{\"type\":\"+\",\"children\":[{\"type\":\"Identifier\",\"value\":\"x\"},{\"type\":\"NumericLiteral\",\"value\":${x}}]}`
            }
          }
        ]
      }, (e) => {
        if (e.state === 'end') {
          x += e.deltaX;
        }
      });
    }
    
    bind();
    
    blockEl.addEventListener('touchstart', () => {
      bind();
    });
    
    
    
    

    Install

    npm i bindingx-web-polyfill

    DownloadsWeekly Downloads

    170

    Version

    0.1.18

    License

    Apache-2.0

    Unpacked Size

    225 kB

    Total Files

    39

    Last publish

    Collaborators

    • chuyi
    • huxiaoqi