Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I initialise docsify on a later request #804

Closed
nothingrandom opened this issue Apr 1, 2019 · 5 comments
Closed

How can I initialise docsify on a later request #804

nothingrandom opened this issue Apr 1, 2019 · 5 comments

Comments

@nothingrandom
Copy link

If I want to delay the init of docsify to then trigger it on my own terms, is that possible?

@timaschew
Copy link
Member

You can delay loading the docsify script.

@nothingrandom
Copy link
Author

Hmm, presuming you're suggesting I use a setTimeout?

Not quite what I want. I've got two window components in the same index.html, one for Vue and one for docsify. Vue is handling the whole of my app, including auth. I need to pass the auth token to docsify from Vue and then "start" docsify, because starting it before I have the auth token passed as a header gives me a 404 request (expected for our configuration). Which is why I'm asking if there's a way to reinitialise, or only start it when I want it to be started.

I wasn't able to find anything in the docs / wiki that would enable this though?

@timaschew
Copy link
Member

You Can try something like this:

docsify/test/_helper.js

Lines 42 to 59 in d80aa21

// mimic src/core/index.js but for Node.js
function Docsify() {
this._init()
}
const proto = Docsify.prototype
const {initMixin} = require('../src/core/init')
const {routerMixin} = require('../src/core//router')
const {renderMixin} = require('../src/core//render')
const {fetchMixin} = require('../src/core/fetch')
const {eventMixin} = require('../src/core//event')
initMixin(proto)
routerMixin(proto)
renderMixin(proto)
fetchMixin(proto)
eventMixin(proto)

@timaschew
Copy link
Member

Of course this is ugly any maybe even doesn't work for you since some of the function might not be expoed.

I will implement a single function which will be exposed to init docsify. In the config you can disable automatic initialization

@trusktr
Copy link
Member

trusktr commented Jun 21, 2020

The above is too difficult to do (too many manual steps, custom bundle building, and requires further manual intervention to bring in new Docsify features when they are released).

This will be addressed as a non-breaking change in #799

@trusktr trusktr closed this as completed Jun 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants