
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
@okiba/component
Advanced tools
Manages a DOM component, binds UI and recursively binds child components. Can be extended or instantiated
__
// ./components/Slider.js
import Component from '@okiba/component'
import SliderControls from '@components/SliderControls'
const ui = {
slides: '.slide',
}
const components = {
controls: {
selector: '.slider-controls', type: SliderControls, options: {big: true}
}
}
class Slider extends Component {
constructor({el, options}) {
super({el, ui, components, options})
this.ui.slides.forEach(
slide => slide.style.opacity = 0
)
this.components.controls.forEach(
controls => controls.onNext(this.next.bind(this))
)
}
}
// ./main.js
import {qs} from '@okiba/dom'
import Component from '@okiba/component'
import Slider from './components/Slider'
const app = new Component({
el: qs('#app'),
components: {
selector: '.slider', type: Slider
}
})
npm i --save @okiba/component
Or import it directly in the browser
<script type="module" src="https://unpkg.com/@okiba/component/index.js"></script>
import Component from '@okiba/component'
Okiba Core packages are not transpiled, so don't forget to transpile them with your favourite bundler. For example, using Babel with Webpack, you should prevent imports from okiba to be excluded from transpilation, like follows:
{
test: /\.js$/,
exclude: /node_modules\/(?!(@okiba)\/).*/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
}
args: ObjectArguments to create a component
el: ElementDOM Element to be bound
ui: Object | optionalUI hash where keys are name and values are selectors
{ buttonNext: '#buttonNext' }
// or
{ buttonNext: selector: '#buttonNext', asArray: true, required: true }
Becomes:
this.ui.buttonNext
components: Object | optionalComponents hash for childs to bind, keys are names and values are component initialization props:
{
slider: {
// Matched using [qs]('https://github/okiba-gang/okiba/packages/dom'), scoped to the current component element
selector: '.domSelector',
// Component class, extending Okiba Component
type: Slider,
// Options hash
options: {fullScreen: true},
// Required component, default is false
required: true
}
viewProgress: {
// Bind ViewProgress component on parent Component dom node
ghost: true,
// Component class, extending Okiba Component
type: ViewProgress
},
buttons: {
selector: 'button',
type: Button,
asArray: true,
}
}
Becomes:
this.components.slider
options: Object | optionalCustom options passed to the component
Virtual method, needs to be overridden It's the place to call cleanup functions as it will be called when your component is destroyed
Should not be overridden, will call onDestroy
and forward destruction to all child components
FAQs
DOM Component for okiba.js
We found that @okiba/component demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.