mech-web

0.2.3 • Public • Published

mech-web

Mech-web provides access to the DOM (document object model).

See Mechanisms Home for more information and other libraries.

Documentation

In This Library

  • elemActive - access to active element.
  • elemById, e$ - returns access to a single DOM element (#id).

elemActive

elemActive returns access to active DOM element.

Examples

Get active element.

m.elemActive().go;

elemByID, e$

elemByID returns access to a single DOM element (id).

id can be:

  • a primitive value
    • m.elemByID("hello")
    • m.elemByID(0)
  • a mechanism
    • m.elemByID(m.str("hello"))
    • m.elemByID(m.num(3))

Examples

Get an element.

mw.elemByID("left").go;

Get the value of an element with the id "left":

m.propGet("value",m.e$("left")).go;

Set the value of an element with the id "left" to 23:

m.propSet("value",m.e$("left"),23).go;

Setup

Using In Your Projects

Change directory to your node project.

$ npm install mech-web --save

Development

Get Involved!

There are a lot of core mechanisms just waiting to be created. Many of them can be created in a few hours including in-depth tests. Clone mech-library to get started!

Setup

Install:

$ npm install

Continuous test:

$ gulp

Test:

$ gulp webtests

Test Server

Read documentation in gulpfile.js to see how to setup automated web testing.

$ gulp webserver

Package Sidebar

Install

npm i mech-web

Weekly Downloads

0

Version

0.2.3

License

MIT

Last publish

Collaborators

  • erichosick