vimeshjs / vimesh-ui

Vimesh UI is an ultra lightweight library to build UI components for Alpine.js
MIT License
125 stars 5 forks source link

$api why there #13

Closed ericxin1982 closed 9 months ago

ericxin1982 commented 9 months ago

image

HI @xinjie-zhang

I understood $api.init(), since init() is defined inside script, and why need to write $api && $api.init() together, what is the purpose of using $api that way?

Thanks Eric Xin

xinjie-zhang commented 9 months ago

When x-init is executing, the $api may not exist, $api && $api.init() will ensure $api has been created.

ericxin1982 commented 9 months ago

Got it.