首页
/ BiwaScheme 技术文档

BiwaScheme 技术文档

2024-12-24 15:28:46作者:傅爽业Veleda

本文档旨在帮助用户安装、使用 BiwaScheme,并详细介绍其 API 和安装方式。

1. 安装指南

环境要求

  • Node.js(测试版本为 v16.5.0)
  • npm(测试版本为 v7.20.1)

安装步骤

使用 npm 全局安装

$ npm install -g biwascheme

使用 npm 本地安装

$ npm install biwascheme

2. 项目的使用说明

在浏览器中使用

只需加载 biwascheme.jsbiwascheme-min.js 文件,然后编写 Scheme 代码。

<!DOCTYPE html>
<html>
<body>

<div id="bs-console"></div>

<script src="biwascheme.js"></script>
<script type="text/biwascheme">
(display "hello, world!")
</script>

</body>
</html>

在 Node.js 中运行 BiwaScheme 脚本

  1. 创建一个名为 a.scm 的文件:

    (display "Hello, world!")
    (newline)
    
  2. 运行脚本:

    $ biwas a.scm
    

在 Node.js 中作为模块使用

  1. 创建一个名为 a.js 的文件:

    var BiwaScheme = require("biwascheme");
    BiwaScheme.run("(+ 1 2)"); // 或者 BiwaScheme.run_file("a.scm");
    
  2. 运行脚本:

    $ node a.js
    

静态构建 BiwaScheme 支持的网站

npm 包包含 biwascheme.mjs,适用于模块打包工具,如 rollup。请参考 svelte-biwascheme-example 示例。

请注意,biwascheme.mjs 不包含 biwascheme-x.y.z.js 中的 jQuery。如果您想使用 src/library/webscheme_lib.js 中定义的函数,需要手动打包 jQuery。

构建 biwascheme.js

构建 biwascheme.js 需要 Node.js 和 npm。

构建步骤请参考 doc/dev/build.md

3. 项目 API 使用文档

BiwaScheme 的 API 使用方法请参考项目官方文档。

4. 项目安装方式

如上所述,可以使用 npm 进行全局或本地安装。

# 全局安装
$ npm install -g biwascheme

# 本地安装
$ npm install biwascheme

以上就是关于 BiwaScheme 的技术文档,希望对您有所帮助。

登录后查看全文
热门项目推荐