-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add "Examples" navigation link
Add the top navigation link "Examples" and a new page that explains how to acquire Fiddle and run the examples available in the sidebar. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Partial work on #2
- Loading branch information
Showing
5 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const fs = require('fs').promises; | ||
const path = require('path'); | ||
|
||
const newContent = new Map([['how-to-examples.md', 'how-to/examples.md']]); | ||
|
||
/** | ||
* Copies the new content files to the destination | ||
* @param {string} destination | ||
*/ | ||
const copyNewContent = async (destination) => { | ||
for (const [source, target] of newContent) { | ||
await fs.copyFile( | ||
path.join(__dirname, source), | ||
path.join(destination, target) | ||
); | ||
} | ||
}; | ||
|
||
module.exports = { | ||
copyNewContent, | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
title: 'Examples' | ||
description: 'Electron examples directly for you to use' | ||
slug: examples | ||
hide_title: false | ||
--- | ||
|
||
# Examples | ||
|
||
In this section we have documented some of the most popular things developers do | ||
in their Electron applications. The easiest way to run the examples is using | ||
[Fiddle][fiddle]. To do this, first you will have to download and install the | ||
right version for your Operating System from [here][fiddle]. | ||
|
||
Once you have done this, you can press on the "Open in Fiddle" button that you | ||
will find below code samples like the following one: | ||
|
||
```fiddle docs/fiddles/quick-start | ||
window.addEventListener('DOMContentLoaded', () => { | ||
const replaceText = (selector, text) => { | ||
const element = document.getElementById(selector) | ||
if (element) element.innerText = text | ||
} | ||
for (const type of ['chrome', 'node', 'electron']) { | ||
replaceText(`${type}-version`, process.versions[type]) | ||
} | ||
}) | ||
``` | ||
|
||
## How to...? | ||
|
||
The following are all the "How to?" available at the moment (you can access them | ||
from the sidebar as well). If there is something that you would like to do that | ||
is not documented, please join our [discord server][] and let us know! | ||
|
||
[discord server]: https://discord.com/invite/electron | ||
[fiddle]: https://www.electronjs.org/fiddle |
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