react-vimjs icon indicating copy to clipboard operation
react-vimjs copied to clipboard

Lazy vim.js loading

Open rhysd opened this issue 9 years ago • 0 comments

Currently this component assumes that vim.js is loaded by <script> tag. However, it always requires loading vim.js even if it is not used. vim.js is big and takes time to load. I want to load vim.js lazily.

I add vimjsPath property to <Vim> component, which is an optional string. If it is specified, <Vim> doesn't assume <script> tag loads vim.js. <Vim> dynamically create <script className="vimjs" src={props.vimjsPath}> element and insert it to inner <Vim>. If already the element is inserted, <Vim> tag doesn't insert it again. <Vim> can detect that by querying with .vimjs selector.

rhysd avatar Oct 14 '15 06:10 rhysd