Skip to content

Instantly share code, notes, and snippets.

@marckrenn
Created July 4, 2017 13:19
Show Gist options
  • Save marckrenn/04aaf5c1ca75c56412468721fa4d5511 to your computer and use it in GitHub Desktop.
Save marckrenn/04aaf5c1ca75c56412468721fa4d5511 to your computer and use it in GitHub Desktop.
testDrive snippet for Framer
plugin.run = (contents, options) ->
"""
# <fold>
# Include testDrive + Instructions
td = "testDrive.js"
if localStorage.getItem(td)?
exports = window
eval(localStorage.getItem(td))
else
Utils.domLoadData "http://krenn.me/td.js", (err, module) ->
localStorage.setItem(td, module)
window.location.reload()
# • LOG AVAILABLE MODULES (see Inspect → Console)
#testDrive.availableModules (modules) -> console.log(modules)
# • USAGE:
# testDrive.modules [<availableModules>]
# or
# testDrive.module "<availableModule>"
# or just type e.g.
# fb = new Firebase # and wait 2-3 seconds, "Autopilot"-feature
# • NOTE: All module-classes, -methods and -functions are added to your project's global scope, so you may not use the usual yourModule.function-prefix!
# • UPDATE testDrive (de-comment temporarily)
#localStorage.removeItem(td)
# </fold>
#{contents}
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment