xulrunner/examples/simple/components/src/SimpleTest.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/xulrunner/examples/simple/components/src/SimpleTest.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,27 @@
     1.4 +/* vim:set ts=2 sw=2 sts=2 et cin: */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
    1.10 +
    1.11 +function SimpleTest() {
    1.12 +}
    1.13 +
    1.14 +SimpleTest.prototype = {
    1.15 +  classID: Components.ID("{4177e257-a0dc-49b9-a774-522a000a49fa}"),
    1.16 +
    1.17 +  QueryInterface: function(iid) {
    1.18 +    if (iid.equals(Components.interfaces.nsISimpleTest) ||
    1.19 +        iid.equals(Components.interfaces.nsISupports))
    1.20 +      return this;
    1.21 +    throw Components.results.NS_ERROR_NO_INTERFACE;
    1.22 +  },
    1.23 +
    1.24 +  add: function(a, b) {
    1.25 +    dump("add(" + a + "," + b + ") from JS\n");
    1.26 +    return a + b;
    1.27 +  }
    1.28 +};
    1.29 +
    1.30 +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([SimpleTest]);

mercurial