Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
pkgs=`cat .merlin \
| grep "PKG" \
| grep -v "\." \
| sed -e "s/PKG //g" \
| awk '{ print $0 }'`
for pkg in $pkgs
do
enum Color {
Red,
Blue,
Green
}
enum Temp {
Hot,
Cold
}
open Core.Std
(*
1. bool
true false
2. int
1
3. float
1.0
4. list

Add Sqlite support to Exponent

Challenges

Multiple versions of RN

Secure isolation

Is it ok to prefix database path with current experience’s name?

note: keep running `tools_public/gulp` or you will get an error: exponent requires an internet connection.

Clojurescript on Exponent

Why

1. Simple made easy

It’s much easier than Using React Native with Clojurescript, so beginners don’t have to be nervous!

a. Single entry

No separate iOS or Android projects, do support separate iOS or Android Javascript modules.

b. Only dance with Clojurescript, no native.

Solve the externs

1. Recursively scan source-path/.cljs[cljc]* to find all unused vars and interops.

Idea from https://gist.github.com/Chouser/5796967, currently exponent-cljs-template uses this way.

2. Transform all interop to aget

So closure compiler will not rename the properties or calls under advanced compilation.

repos use this idea:

  1. cljs-oops
  2. fence
;; externs generated
var Components={};
Components.LinearGradient=function(){};
var Animated={};
Animated.Image=function(){};
var Animated={};
Animated.Value=function(){};
var lymchat.shared.ui={};
lymchat.shared.ui.animated-interpolate=function(){};
var lymchat.shared.ui={};
(ns lymchat.storage
(:refer-clojure :exclude [update])
(:require [lymchat.core-async-storage :as s]
[re-frame.core :refer [dispatch]]
[cljs.core.async :refer [<!]]
[re-frame.db :refer [app-db]]
[lymchat.util :as util]
[cljs-time.core :as t]
[cljs-time.coerce :as tc])
(:require-macros [cljs.core.async.macros :refer [go]]))
(ns lymchat.storage
(:refer-clojure :exclude [update])
(:require [glittershark.core-async-storage :as s]
[cljs.core.async :refer [<!]])
(:require-macros [cljs.core.async.macros :refer [go]]))
(defn development?
[]
(true? js/__DEV__))
10:22:43 PM
<START> request:/js/main.bundle?platform=ios&dev=true&strict=false&minify=false&hot=false&assetPlugin=exponent/tools/hashAssetFiles&includeAssetFileHashes=true
10:22:45 PM
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1:
10:22:45 PM
node::Abort() [/Applications/Exponent XDE.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libnode.dylib]
2: node::Environment::exports_string() const [/Applications/Exponent XDE.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libnode.dylib]
3: v8::Utils::ApiCheck(bool, char const*, char const*) [/Applications/Exponent XDE.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libnode.dylib]
4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/Applications/Exponent XDE.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libnode.dylib]