Brian Heim 2018-06-19
- Introduction
FourteenBitCC { | |
/* | |
//Use Case: | |
MIDIIn.connectAll; | |
~x = FourteenBitCC.new("x", 72, 104); | |
~x.func = {|val| ("x: "++val).postln}; | |
//MPE Example with Sensel Morph | |
MIDIIn.connectAll |
Add a new :target
option, :bundle
. When this target is set :nodejs
is true
and :nodejs-rt
is false
. We want to take advantage of the fact that the :nodejs
target
emits Node.js require
for libs found in node_modules
. :nodejs-rt false
clarifies that
we are not actually going to target the Node.js runtime.
The :bundle
target always generates an index.js
file, it need only be created once.
The contents of index.js looks like the following:
NOTE: This proposal is dead. A simpler solution was arrived at via the new `:bundle` target.
The current Webpack solution works reasonable well for application oriented development, but does not address the wider issue of developing ClojureScript libraries that depend on the wider JavaScript ecosystem where the artifacts do not reside in Java-centric distrubtion like Maven (i.e. NPM). Currently a ClojureScript library cannot express these kinds of foreign library dependencies at all. Thus users must constantly redefine basic dependencies from NPM such as React, boilerplate Webpack configuration, boilerplate import/export files, and thus cannot create and share reusable ClojureScript components that depend on this vast ecosystem.
( | |
var notes, synths, on, off, mod, bend, touch; | |
~num_channels = 8; | |
~bend_range = 24; | |
MIDIIn.connectAll; | |
notes = Array.newClear(~num_channels); | |
synths = Array.newClear(~num_channels); |
// Twister devices are expected to be named in this form: | |
// classvar <endpointDevice="Midi Fighter Twister %", <endpointName="Midi Fighter Twister"; | |
// Where "Midi Fighter Twister 1" is TwisterDevice(\default) and "Midi Fighter Twister 2" is TwisterDevice(\secondary) | |
// A twister device. These are singletons - there is only ever one registered per device. It works ala Ndef, Pdef, etc, see Singleton help file. | |
~device = TwisterDevice(\default); | |
// If your MIDI Fighter is named something other than the above, you can register it via: | |
this.registerDevice(\myDevice, "endpoint device", "endpoint name"); | |
// And then access it via TwisterDevice(\myDevice) |
DummyMIDI { | |
var dummy = 0; | |
*new { | |
^super.newCopyArgs(); | |
} | |
noteOn {} | |
noteOff {} | |
control {} |
;; src/cljs/hello_world/core.cljs | |
(ns hello-world.core) | |
(println "Hello, world!") |
("goog.debug.Error" | |
"goog.dom.NodeType" | |
"goog.string" | |
"goog.asserts" | |
"goog.reflect" | |
"goog.object" | |
"goog.math.Integer" | |
"goog.string.StringBuffer" | |
"goog.array" | |
"goog.math.Long" |
NOTE: This gist uses the master branch of ClojureScript. Clone ClojureScript and from the checkout run
./script/bootstrap
and./script/uberjar
. This will producetarget/cljs.jar
which you can use to follow this guide.
As client applications become larger it becomes desirable to load only the code actually
required to run a particular logical screen. Previously ClojureScript :modules
compiler option
permitted such code splitting, but this feature only worked under :advanced
compilation
and users would still have to manage loading these splits. :modules
also required manual