Skip to content
marcoscaceres edited this page Jan 18, 2013 · 5 revisions

Below is a template that can be copied for defining a new type. Just replace XXX for the type you want to define.

/*
Copy section 3.X from WebIDL spec that defines the type. 
*/

define(function(require) {
    'use strict';
    var IDLType = require('types/IDLType'),
        WebIDL = require('interfaces/WebIDL');

    WebIDL.XXX = function(value) {
        if (!(this instanceof WebIDL.XXX)) {
            return toXXX(value);
        }
        //call super constructor
        IDLType.call("XXX", toXXX);
        this.value = value;
    };

    /*
    Copy section 4.x from WebIDL that defines the conversion. 
    */
    function toXXX(V) {

    }

    WebIDL.XXX.prototype = IDLType;
});
Clone this wiki locally