react-vimjs
react-vimjs copied to clipboard
Lazy vim.js loading
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.