Last active
April 14, 2017 21:08
-
-
Save stakes/2b3d72fd55021117d3ff to your computer and use it in GitHub Desktop.
Framer.js module to open prototypes in Frameless
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add the following line to your project in Framer Studio. | |
# `frameless = require "frameless"` | |
frameless = {} | |
# Directly opens the prototype in Frameless | |
frameless.open = -> | |
intent = "frameless://" | |
url = intent + window.location.host + window.location.pathname + "/" | |
window.location.replace url | |
# Check if a browser's in fullscreen mode | |
frameless.isFullscreen = -> | |
if "standalone" in window.navigator and window.navigator.standalone then true else false | |
# Opens in Frameless if you're on a mobile device, whether you | |
# are opening the prototype in Safari or from the homescreen | |
frameless.redirectMobile = -> | |
if Utils.isMobile() && (Utils.isSafari() or frameless.isFullscreen()) then frameless.open() | |
# Only opens in Frameless from mobile Safari | |
frameless.redirectSafari = -> | |
if Utils.isMobile() && Utils.isSafari() then frameless.open() | |
# Only opens in Frameless from the homescreen | |
frameless.redirectHomescreen = -> | |
if Utils.isMobile() && frameless.isFullscreen() then frameless.open() | |
_.extend(exports, frameless) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment