Browserjs
An implementation of browser JavaScript APIs for securable modules / ServerJS compatible environments, such as Narwhal
Install / Use
/learn @280north/BrowserjsREADME
browserjs
BrowserJS is a CommonJS package that emulates portions of the browser JavaScript APIs.
Supported APIs
- XMLHttpRequest
- setTimeout, setInterval, clearTimeout, clearInterval
- console.log, error, warn, debug
- DOMParser and basic DOM operations (Rhino only)
Usage
To get access to individual APIs, require the corresponding module. For example, if you just w
var XMLHttpRequest = require("browser/xhr").XMLHttpRequest;
To get the "window" object, which contains all the APIs, require the "browser/window" module:
var window = require("browser/window");
Use the properties of the window object directly:
var request = new window.XMLHttpRequest();
Or you can bring all the properties of the "window" object into scope temporarily (without modifying the global scope) by using a with statement:
with (window) {
var request = new XMLHttpRequest();
}
If you want to permanently modify the global scope to include all the properties of "window" in the global scope, simply require the "browser" module:
require("browser")
Related Skills
node-connect
349.9kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.9kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.9kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
