Skip to content

thedavidmeister/hoplon-drift

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hoplon-drift

Drift in Hoplon.

https://www.drift.com/ http://hoplon.io/

Installation

Clojars Project

Uses snippet version 0.3.1 from Drift installation docs.

Drift config

hoplon-drift.data/id can be set with :closure-defines in the compiler options for CLJS. This is optional as the id can be passed to the snippet at runtime (see below).

A convenience fn hoplon-drift.compile/with-closure-defines is provided.

with-closure-defines accepts your existing config and an id directly, returns the config with the id merged in.

The id is also supported as an environment variable as per environ under :drift-id.

There is an example of this in build.boot.

Drift externs

If you're using advanced compilation for cljs you will need to provide externs.

Current working externs for Drift can be found in externs.js.

Usage

Simply call hoplon-drift.hoplon/snippet with either your drift id or without any arguments to fallback to the configured drift id (see above).

API

Interacting with the widget can be done through hoplon-drift.api.widget fns.

Currently only show! and hide! are supported but extending this is pretty easy and pull requests are welcome!

Demo

There is a demo widget hosted on github pages:

https://thedavidmeister.github.io/hoplon-drift/