Giter VIP home page Giter VIP logo

purescript-dom's Introduction

purescript-dom

Latest release Build Status Dependency Status Maintainer: garyb

Type definitions, low level interface implementations, and standard effect type for use while interacting with the DOM.

Installation

bower install purescript-dom

Introduction

purescript-dom is intended to provide a common base for projects that need to talk to or about the DOM.

The API isn't primarily intended for "human consumption", but instead aims to provide functions and types that match up with the interfaces described in the DOM4 and HTML5 specifications, with a minimal amount of additional opinion as to how they should be implemented in PureScript.

This consists of:

  • foreign data types for the various interfaces described.
  • Functions that read Foreign typed values (and IsForeign instances) for foreign types.
  • No classes or other niceties to aid with subtyping relationships. However, coercions are provided from subtypes to their supertypes. For example, from DOM.Node.Types, elementToNode.
  • Functions that can mutate the DOM, or that don't always return the same value, or return a value that may be mutated at a distance use Eff with the DOM effect
  • Enumeration values are provided as ADTs, but with an option to read the raw value too. For example, from DOM.Node.Node, nodeType and nodeTypeIndex.

Module structure

Interfaces from DOM4 are grouped under DOM.Node and interfaces from HTML5 are grouped under DOM.HTML, aside from event-related things which are grouped under DOM.Events. Additionally there are a few other useful DOM interfaces such as the File and XMLHttpRequest2 that have their own submodules.

In each submodule there is a .Types which should enumerate foreign data types for the interfaces within and the coercions and Foreign-reading functions that go with them. After that each interface should have its own submodule - so for example, Element is provided in DOM.Node.Types and the functions from the Element API are defined in DOM.Node.Element. Enumeration types such as NodeType also get their own modules, such as DOM.Node.NodeType.

Module documentation is published on Pursuit: http://pursuit.purescript.org/packages/purescript-dom

Non-standards compliant interfaces

Currently we're choosing not to implement deprecated or non-standard interfaces even if they are commonly available. The innerHTML property of Element and keyCode/charCode of KeyboardEvent being examples of this. Ideally this module will only provide types and functions that "everyone" can agree on. This also means new parts of the specifications that are currently not widely available may also be omitted for the time being, however this only applies to the API implementation, types for new interfaces will be included as needed.

purescript-dom's People

Contributors

garyb avatar beckyconning avatar jonsterling avatar nwolverson avatar eskimor avatar jprider63 avatar zudov avatar joneshf avatar sharkdp avatar menelaos avatar anttih avatar hdgarrood avatar manpages avatar megamaddu avatar paf31 avatar rgrempel avatar stebulus avatar

Watchers

James Cloos avatar Adam Rosenblatt avatar  avatar

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.