ndn-js
Version:
A JavaScript client library for Named Data Networking
56 lines (48 loc) • 2.25 kB
Plain Text
/* This file is created by running make-ndn-js.jsm.sh in this directory.
* It concatenates ndn-js-header.txt with all the ndn-js source files to
* make ndn-js.jsm .
* The file ../../build/ndn.min.js must already be built.
*
* Copyright (C) 2013-2019 Regents of the University of California.
* author: Jeff Thompson <jefft0@remap.ucla.edu>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* A copy of the GNU Lesser General Public License is in the file COPYING.
*/
var EXPORTED_SYMBOLS = ["Data", "DataUtils", "Exclude", "ExponentialReExpress",
"Interest", "MimeTypes", "Face", "Name", "Sha256", "XpcomTransport", "Buffer"];
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/NetUtil.jsm");
// jsbn.js needs the navigator object which isn't defined in XPCOM, so make a local hack.
var navigator = {
appName: "Netscape"
};
// Some code calls console.log without checking LOG>0. Until this is cleaned up, make a local hack console.
var console = {
log: function(message) {
dump(message);
dump("\n");
}
};
// The Face class uses setTimeout and clearTimeout, so define them using XPCOM.
function setTimeout(callback, delay) {
var timer = Components.classes["@mozilla.org/timer;1"].createInstance(Components.interfaces.nsITimer);
timer.initWithCallback({notify: callback}, delay, Components.interfaces.nsITimer.TYPE_ONE_SHOT);
return timer;
}
function clearTimeout(timer) {
timer.cancel();
}
// Set self so that Dexie in ndn.min.js can set properties (although this add-on doesn't use Dexie).
var self = {};