2.0.1 • Published 5 months ago
@potch/html-bin v2.0.1
html-bin
a codebin widget for embeddable editable live demos built on top of CodeMirror
API
createBin
create a bin component.
Options:
container(optional Element): will automatically append the bin if providedsources: object with optional{ js, css, html }strings of source to put in the corresponding editorssplit: number from 0, 1 specifying the ratio between the editor and preview panes. defaults to0.5width: CSS string to override default--bin-widthvalue. defaults to100%height: CSS string to override default--bin-heightvalue. defaults to512px
Returns object with the following fields:
el: Element of the outermost HTML element of the bineditors: contains{ js, css, html }properties with the CodeMirror instances for each editor tabactiveTab: a signal representing the currently active editor tabstart: call this function if you did not provide thecontaineroption after attachingelto the DOMteardown: call this if you are removing and destroying the bin to disconnect all listeners