-
-
Save cj/583e18f219af6ec6a43e to your computer and use it in GitHub Desktop.
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
module Opal::Connect | |
module ConnectPlugins | |
module Pjax | |
def self.load_dependencies(connect) | |
connect.plugin :events | |
end | |
if RUBY_ENGINE == 'opal' | |
`require('expose?$!expose?Pjax!pjax')` | |
`require('expose?$!expose?NProgress!nprogress')` | |
`require('nprogress/nprogress.css')` | |
ConnectSetup = -> do | |
on(:document, 'pjax:send') { `NProgress.start(); NProgress.inc()` } | |
on(:document, 'pjax:complete') { `NProgress.done()` } | |
`new Pjax({elements: 'a', selectors: ['#k-menu', '.container']})` | |
end | |
end | |
end | |
register_plugin :pjax, Pjax | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment