New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cycle-classic-dom

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cycle-classic-dom

/** * cycle-classic-dom * ------------------- * * A tiny helper library for working with classic JS libraries. * * That is to say, any JS library that works by taking a reference * to an element and manipulating the DOM directly. * * `npm install

  • 2.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-25%
Maintainers
1
Weekly downloads
 
Created
Source

/**

  • cycle-classic-dom

  • A tiny helper library for working with classic JS libraries.
  • That is to say, any JS library that works by taking a reference
  • to an element and manipulating the DOM directly.
  • npm install cycle-classic-dom */

import { div, VNode } from "@cycle/dom"; import { Stream } from "xstream";

export type Constructor = (el: HTMLElement) => void;

export function makeVNode(ctor: Constructor): VNode { return div({ key: Math.random().toString(), hook: { insert: vnode => ctor(vnode.elm) } }); }

/**

  • Example, sets up a simple xterm.js powered terminal:
  • import { makeVNode } from 'cycle-classic-dom';
    
  • import { makeDOMDriver } from '@cycle/dom';
    
  • import { Terminal } from 'xterm'
    
  • import xs from 'xstream';
    
  • function main() {
    
  •   const terminal = new Terminal();
    
  •   terminal.write("Hello from \x1B[1;3;31mxterm.js\x1B[0m $ ");
    
  •   const terminalVNode = makeVNode(element => {
    
  •     terminal.open(element);
    
  •     terminal.refresh(0, terminal.rows - 1);
    
  •   });
    
  •   return {
    
  •     DOM: xs.of(terminalVNode)
    
  •   }
    
  • }
    
  • run(main, {DOM: makeDOMDriver(document.body)});
    
  • For a larger example including capturing output, see the example directory */

FAQs

Package last updated on 23 Aug 2018

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc