Permalink
Browse files

Better way to set up the preloader context so it will be inside the d…

…evice.
  • Loading branch information...
eelco committed Jul 28, 2016
1 parent f3cfea6 commit 59d1622d462cfc263784b6864c88df42056719a0
Showing with 12 additions and 2 deletions.
  1. +12 −2 framer/Extras/Preloader.coffee
@@ -11,7 +11,14 @@ class Preloader extends BaseClass
@timeout = 30
@context = new Context({parent: Framer.CurrentContext, name: "Preloader"})
@start()
setupContext: ->
parentContext = Framer.Device?.context
parentContext ?= Framer.CurrentContext
@context = new Context({parent: parentContext, name: "Preloader"})
@context.run =>
@@ -27,6 +34,7 @@ class Preloader extends BaseClass
@progressIndicator.railsColor = Color.grey(0, 0.1)
@progressIndicator.progressColor = "rgb(75,169,248)"
@progressIndicator.setProgress(@progress, false)
@brand = new Layer
width: 96
@@ -97,6 +105,8 @@ class Preloader extends BaseClass
return if @isLoading
@setupContext()
@_isLoading = true
@_startTime = Date.now()
@@ -127,7 +137,7 @@ class Preloader extends BaseClass
_handleProgress: =>
@emit("progress", @progress)
@progressIndicator.setProgress(@progress, false)
@progressIndicator?.setProgress(@progress, false)
@_handleLoaded() if @isReady
_handleLoaded: ->

0 comments on commit 59d1622

Please sign in to comment.