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

Add bespoke sync plugin #145

Merged
merged 5 commits into from
Sep 10, 2019
Merged

Add bespoke sync plugin #145

merged 5 commits into from
Sep 10, 2019

Conversation

yhatt
Copy link
Member

@yhatt yhatt commented Sep 10, 2019

The created sync plugin for Bespoke.js makes the state of progress synchronize between multiple windows with passed the same sync key.

Below example defines specific sync key by passing sync query parameter.

sync

In major browsers, localStorage in file:// protocol had not worked as of starting development Marp CLI. But now it seems to work. Thus, we will sync the state of slide progress (with fragments support) by using localStorage and storage event.

This is preparation of future working for the presenter view (#142), and we are not be assumed using sync query parameter directly.

ToDo

  • Add tests

@@ -76,15 +76,17 @@
"@types/ws": "^6.0.2",
"@types/yargs": "^13.0.2",
"autoprefixer": "^9.6.1",
"bespoke": "^1.1.0",
"bespoke": "bespokejs/bespoke",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to use Bespoke.js from GitHub directly because Bespoke.prototype.destroy() is not defined in the latest release on npm.

browser: !!opts.browser,
mainFields: ['module', 'jsnext:main', 'main'],
}),
replace({ 'process.env.NODE_ENV': JSON.stringify('production') }),
Copy link
Member Author

@yhatt yhatt Sep 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bundled nanoid package cannot work without replacing process.env.NODE_ENV.

See also: ai/nanoid#127 (comment)

@yhatt yhatt merged commit 804b0c1 into master Sep 10, 2019
@yhatt yhatt deleted the bespoke-sync branch September 10, 2019 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant