How to use the diffhtml.addTransitionState function in diffhtml

To help you get started, we’ve selected a few diffhtml examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tbranyen / diffhtml / packages / diffhtml-middleware-inline-transitions / index.js View on Github external
});

          const hasPromise = retVal.some(ret => Boolean(ret && ret.then));

          // This is the only time the return value matters.
          if (hasPromise) {
            return Promise.all(retVal);
          }
        }
      };

      // Save the handler for later unbinding.
      boundHandlers.push(handler);

      // Add the state handler.
      addTransitionState(transitionName, handler);
    });
  };
github tbranyen / diffhtml / packages / diffhtml-middleware-inline-transitions / index.js View on Github external
const subscribe = () => {
    addTransitionState('attributeChanged', attributeChanged);

    // Add a transition for every type.
    keys(transitionsMap).forEach(name => {
      const map = transitionsMap[name];
      const transitionName = eventsToTransitionName[name] || name;

      const handler = function(child, ...rest) {
        // If there are no elements to match here, abort.
        if (!map.size) {
          return;
        }

        // If the child element triggered in the transition is the root
        // element, this is an easy lookup for the handler.
        if (map.has(child)) {
          return map.get(child)(child, child, ...rest);
github tbranyen / diffhtml / packages / diffhtml-prollyfill / index.js View on Github external
    value: (state, callback) => addTransitionState(state, callback),
  });