Skip to content

Latest commit

 

History

History
200 lines (160 loc) · 7.63 KB

File metadata and controls

200 lines (160 loc) · 7.63 KB

thi.ng/typedarrays

Contents

About the project

Description

This small library provides constructors & Clojurescript sequence converters for JavaScript typed arrays and ArrayBuffers.

Namespaces

Tests

Project definition

Injected properties

0.1.7

Dependencies

Runtime

[org.clojure/clojure "1.11.1"]
[org.clojure/clojurescript "1.11.4"]

Development

[com.cemerick/clojurescript.test "0.3.3"]
[lein-cljsbuild "1.1.8"]

Building this project

This project is written in a literate programming format and requires Emacs & Org-mode to generate usable source code. Assuming both tools are installed, the easiest way to generate a working project is via command line (make sure emacs is on your path or else edit its path in tangle.sh):

git clone https://github.com/thi.ng/typedarrays.git
cd typedarrays
./tangle.sh src/*.org test/*.org

Tangling is the process of extracting & combining source blocks from .org files into an actual working project/source tree. Once tangling is complete, you can cd into the generated project directory (babel) and then use lein as usual.

Testing

The project.clj file defines an alias to trigger a complete build & tests. Since PhantomJS (the usual test runner for other thi.ng projects) doesn’t support typed arrays, the cleantest command will run the tests in your default browser. Test results are displayed in the dev console.

cd babel
lein cleantest

Tangling this file will also generate a small HTML harness for the resulting JS file and will be placed in the main folder (babel/index.html), allowing for further experimentation in the browser.

Leiningen project file

(defproject thi.ng/typedarrays "<<version>>"
  :description  "CLJS typed arrays functions"
  :url          "<<project-url>>"
  :license      {:name "Apache Software License 2.0"
                 :url "http://www.apache.org/licenses/LICENSE-2.0"
                 :distribution :repo}
  :scm          {:name "git"
                 :url "git@github.com:thi-ng/typedarrays.git"}

  :min-lein-vesion "2.4.0"

  :dependencies [<<dep-clj>>
                 <<dep-cljs>>]

  :profiles     {:dev {:plugins [<<dep-cljsbuild>>
                                 <<dep-cljs-test>>]
                       :global-vars {*warn-on-reflection* true}
                       :jvm-opts ^:replace []
                       :aliases {"cleantest" ["do" "clean," "cljsbuild" "test"]}}}

  :cljsbuild    {:builds [{:id "simple"
                           :source-paths ["src" "test"]
                           :compiler {:output-to "<<cljs-artefact-path>>"
                                      :optimizations :whitespace
                                      :pretty-print true}}]
                 :test-commands {"unit-tests" ["open" :runner "index.html"]}}

  :pom-addition [:developers [:developer
                              [:name "Karsten Schmidt"]
                              [:url "https://thi.ng"]
                              [:timezone "1"]]])

ClojureScript HTML harness

<!DOCTYPE html>
<html lang="en">
  <head>
    <title><<lein-coords>> test</title>
  </head>
  <body>
    <script type="text/javascript" src="<<cljs-artefact-path>>"></script>
  </body>
</html>

Accessing library version during runtime

The autogenerated namespace thi.ng.typedarrays.version contains a single symbol version holding the version string defined above:

(use '[thi.ng.typedarrays.version])

(prn version)
; "<<version>>"

Version namespace

Release history

VersionReleasedDescriptionTagged Github URL
0.1.72022-04-23update description0.1.7
0.1.62016-07-02add .slice polyfill, update cljs dep0.1.6
0.1.52016-04-28add array view fns, bugfix ctors, update deps0.1.5
0.1.32016-03-19bugfix TA check, update ctors0.1.3
0.1.22015-06-04remove obsolete namespaces0.1.2
0.1.12015-05-31update array check0.1.1
0.1.02015-05-26initial test release0.1.0

Contributors

NameRoleWebsite
Karsten Schmidtinitiator & principal developerhttps://thi.ng

License

This project is open source and licensed under the Apache Software License 2.0.