Giter VIP home page Giter VIP logo

tinix's Introduction

tinix

Shortcuts for Vanilla JavaScript DOM

tinix is a tiny library of shortcuts for vanilla JavaScript DOM. If all your app needs is a lightweight ajax library then tinix is for you. Only 2k minified. Supports IE9 and above.

Install

$ npm install tinix
$ browserify -r tinix -o tinix.js
// And include tinix.js
<script type="text/javascript" src="tinix.js"></script>

Or use directly in browser from browserify-cdn

<script type="text/javascript" src="http://wzrd.in.nyud.net/bundle/tinix"></script>

And in your javascript

var $ = require("tinix")

$(selector)

Same as document.querySelector

$.all(selector)

Same as document.querySelectorAll

$.style(selector,rootElem or null, property, value)

Changes the selector(s) style.property to value.

$.display(selector, rootElem or null, value)

Changes the selector(s) style.display to value. eg. "none", "block" etc

$.ready(callback)

Callback is called when document.readyState is complete or interactive, depending on the browser and how your scripts are loaded.

XHR functions

Callback is called with error as first argument. Second argument is responseText, or JSON object if JSON response. error will be null for success, or the XMLHttpRequest object for failure.

$.get(url, callback [,overrideMimeType])

$.post(url, body, contenttype, callback)

$.postJSON(url, body, callback)

body is json object

$.getR(callback)

Returns the request object with onload set. Set request parameters and call request.send. Use if the request types provided above are not enough.

<Element>.on

Same as <Element>.addEventListener

NodeList.forEach

Iterates over a NodeList, callback is called with every element of the NodeList.

tinix's People

Contributors

aksanoble avatar santoshrajan 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.