GithubHelp home page GithubHelp logo

tristancavelier / mixins Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 296 KB

Standards and implementation samples for javascript mixins.

License: Do What The F*ck You Want To Public License

JavaScript 100.00%

mixins's Introduction

Mixins

This document sets standards for mixins. There are 4 levels of API: draft, unstable, stable and frozen. (as NodeJS does.)

License of this document + version

Mixin methods

readableStream

DRAFT

yield read([size]) -> Blob
close()

writableStream

DRAFT

yield write(data)
close()

rest

UNSTABLE

yield head(url) -> Response< undefined > , throws error if status >= 400 or request error
yield get(url) -> Response< Blob > , throws error if status >= 400 or request error
yield put(url, data) -> Response< undefined > , throws error if status >= 400 or request error
yield delete(url) -> Response< undefined > , throws error if status >= 400 or request error

restStream

UNSTABLE

yield getStream(url) -> ReadableResponse< Blob > , throws error if status >= 400 or request error
yield putStream(url) -> WritableRequest XXX

mkcol 'n' propfind

UNSTABLE

yield mkcol(url) -> Response< undefined > , throws error if status >= 400 or request error
yield propfind(url) -> Response< Array<Headers> > , throws error if status >= 400 or request error

Parameters

  • url {String}
  • data {Blob}
  • size {Number}

Mixin objects

Response {Object<T>}

UNSTABLE

  • response.status {Number}
  • [response.statusText] {String}
  • [response.data] {T}
  • response.headers {Headers}

ReadableResponse {Object<T>}

DRAFT

  • response.status {Number}
  • [response.statusText] {String}
  • response.headers {Headers}
  • yield response.read([size]) {StreamDataResult<T>}

Headers {Object<Array<String>>}

UNSTABLE

Example:

{
  "resource-type": ["Collection"],
  "content-length": ["0"],
  "last-modified": ["2000-01-01T01:01:01Z"]
}

(Headers key are in lower case.)

metadata {Object}

STABLE

  • [metadata.identifier] {String}
  • [metadata.title] {String}
  • [metadata.modified] {Date}
  • [metadata.created] {Date}
  • // dublin core...

stat {Object}

DRAFT

  • stat.type {String} (can be: "b", "c", "d", "p", "f", "l", "s" or "D")
  • [stat.dev] {Number}
  • [stat.mode] {Number}
  • [stat.nlink] {Number}
  • [stat.uid] {Number}
  • [stat.gid] {Number}
  • [stat.rdev] {Number}
  • [stat.blksize] {Number}
  • [stat.ino] {Number}
  • [stat.size] {Number}
  • [stat.blocks] {Number}
  • [stat.atime] {Date} (accessed)
  • [stat.mtime] {Date} (modified)
  • [stat.ctime] {Date} (status changed/created)

error {Error}

STABLE

  • response.name {String}
  • response.message {String}
  • [response.status] {Number}
  • [response.headers] {Object<Array<String>>}

Mixin manager

XXX

Mixin samples

XXX

Ajax

XXX

WebDAV

XXX

License of this document + version

Version: 0.3.0

Copyright (c) 2014 Tristan Cavelier [email protected]

This work is free. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See below for more details.

            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
                    Version 2, December 2004

 Copyright (C) 2004 Sam Hocevar <[email protected]>

 Everyone is permitted to copy and distribute verbatim or modified
 copies of this license document, and changing it is allowed as long
 as the name is changed.

            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  0. You just DO WHAT THE FUCK YOU WANT TO.

mixins's People

Contributors

tristancavelier avatar

Watchers

James Cloos 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.