Skip to content

Instantly share code, notes, and snippets.

@koenbok
Created December 1, 2014 17:03
Show Gist options
  • Select an option

  • Save koenbok/55071e29e8bde99a7ad0 to your computer and use it in GitHub Desktop.

Select an option

Save koenbok/55071e29e8bde99a7ad0 to your computer and use it in GitHub Desktop.
Utils.globalLayers = (importedLayers) ->
for layerName, layer of importedLayers
# Replace all whitespace in layer names
layerName = layerName.replace(/\s/g,"")
# Check if there are global variables with the same name
if window.hasOwnProperty(layerName) and not window.Framer._globalWarningGiven
print "Warning: Cannot make layer '#{layerName}' a global, an variable with that name already exists"
else
window[layerName] = layer
window.Framer._globalWarningGiven = true
Utils.globalLayers(androidLayers)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment