This macro just logs values (think console.log
in js).
Example usage: log!(1,2,3,"hello world", [1,2,3])
// Credit Ryan Carniato https://frontendmasters.com/courses/reactivity-solidjs/ | |
let context = []; | |
export function untrack(fn) { | |
const prevContext = context; | |
context = []; | |
const res = fn(); | |
context = prevContext; | |
return res; |
[ | |
526017964561, | |
525608647855, | |
526013197030, | |
526017918501, | |
526013196478, | |
526200201544, | |
526200024126, | |
526014627350, | |
526006502928, |
componentDidMount() { | |
document.addEventListener('click', this.clickOutside.bind(this), true); | |
} | |
componentWillUnmount() { | |
document.removeEventListener('click', this.clickOutside.bind(this), true); | |
} | |
clickOutside(event) { | |
const domNode = ReactDOM.findDOMNode(this); |
Vue.directive('click-outside-element', { | |
bind(el, bind, vn) { | |
el.cO = event => { | |
if (!(el == event.target || el.contains(event.target))) { | |
if(vn.context[bind.expression]) { | |
vn.context[bind.expression](event) | |
} | |
} | |
} | |
document.body.addEventListener('click', el.cO) |
Vue.directive('click-outside-component', { | |
bind(el, binding, vnode) { | |
el.clickOutsideEvent = function(event) { | |
if (!(vnode.context.$el == event.target || vnode.context.$el.contains(event.target))) { | |
vnode.context[binding.expression](event) | |
} | |
} | |
document.body.addEventListener('click', el.clickOutsideEvent) | |
}, | |
unbind(el) { |