Giter Club home page Giter Club logo

ycom's Introduction

ycom

DEPRECATED. Please use nanocomponent or base-element instead.

yo-yo components with classes and events.

npm Build Status Dependency Status devDependency Status node

Usage

const Component = require('ycom')

The module exports Component, a class that should be extended for use by consumers. Component extends EventEmitter, so passing events around is supported out of the box.

#constructor(opts)

  • opts: Passed to EventEmitter. Optional.

#render(): HTMLElement

Should be overridden by consumers to return an instance of HTMLElement.

Check out the npm packages bel, hyperx, and yo-yo for easy generation of HTMLElement instances from Javascript.

#added() / Event: added

When the component node is added to the document, the added prototype method will be called, and the added event will be fired.

#removed() / Event: removed

When the component node is removed from the document, the removed prototype method will be called, and the removed event will be fired.

get #node

Returns the node currently assigned to the component, or generates one if it doesn't exist.

Example

const Component = require('ycom')
const yo = require('yo-yo')

class MyComponent extends Component {

  constructor({ message = '' } = {}) {
    super() // You can pass arguments to the EventEmitter constructor here (optional).
    this.message = message
  }

  added() {
    console.log("called when added to the DOM!")
  }

  removed() {
    console.log("called when removed from the DOM!")
  }

  render() {
    return yo`<em>${this.message}</em>` // compose the component rendering function here
  }
}

let component = new MyComponent({ message: "Hello Javascript!" })

component.once('added', () => console.log("also called when added to the DOM"))
component.once('removed', () =>
  console.log("also called when removed from the DOM")
)

document.body.appendChild(component.node)

License

MIT

ycom's People

Contributors

seangenabe avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

superarturo1

ycom's Issues

An in-range update of global is breaking the build 🚨

Version 4.3.2 of global just got published.

Branch Build failing 🚨
Dependency global
Current Version 4.3.1
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

As global is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this πŸ’ͺ


Status Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build failed Details
Commits

The new version differs by 4 commits .

  • dca6193 4.3.2
  • f187874 Merge pull request #14 from Pauan/master
  • 02428b7 Declaring variables at the top level
  • 5ed779b Moving module.exports to the top level

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of tape is breaking the build 🚨

Version 4.7.0 of tape just got published.

Branch Build failing 🚨
Dependency tape
Current Version 4.6.3
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As tape is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ

Status Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build failed Details

Commits

The new version differs by 19 commits.

  • 1d0df26 v4.7.0
  • 51597e2 Merge pull request #374 from feross/master
  • b06f914 [Refactor] instead of throwing on undefined.forEach, throw explicitly.
  • dd93216 [Fix] fix spurious "test exited without ending"
  • 1a8e936 [Deps] update glob, resolve
  • 7eb9e36 [Dev Deps] update falafel, js-yaml
  • e030260 [Tests] on node v8; no need for sudo; v0.8 passes now; allow v5/v7/iojs to fail.
  • 4375661 [Tests] npm v5+ breaks on node < v4
  • df48bfa Only apps should have lock files.
  • 35e47e1 [Tests] npm v4.6+ breaks on node < v1
  • dc1ffa5 [Deps] update object-inspect
  • 66519cb [Deps] update resolve
  • e6d4625 [Dev Deps] update concat-stream, js-yaml
  • bdf2b04 tap-min moved to derhuerst/tap-min
  • 8b3a77e [Tests] fix thrower stack in node 0.8

There are 19 commits in total.

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of tape-run is breaking the build 🚨

Version 2.4.0 of tape-run just got published.

Branch Build failing 🚨
Dependency tape-run
Current Version 2.3.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As tape-run is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ


Status Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build failed Details
Commits

The new version differs by 2 commits .

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.