]> khamidou — GitHub mirrors - electron.git/commitdiff
docs: Document the filters option.
authorCheng Zhao <zcbenz@gmail.com>
Wed, 6 Aug 2014 07:00:31 +0000 (15:00 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Wed, 6 Aug 2014 07:00:31 +0000 (15:00 +0800)
docs/api/dialog.md

index ad3b2e62221d92c413f0e391d031eea1465f1788..1778e8fb3a82ac3e69e74b878f2d5fb03f70a729 100644 (file)
@@ -19,6 +19,7 @@ console.log(dialog.showOpenDialog({ properties: [ 'openFile', 'openDirectory', '
 * `options` Object
   * `title` String
   * `defaultPath` String
+  * `filters` Array
   * `properties` Array - Contains which features the dialog should use, can
     contain `openFile`, `openDirectory`, `multiSelections` and
     `createDirectory`
@@ -27,6 +28,19 @@ console.log(dialog.showOpenDialog({ properties: [ 'openFile', 'openDirectory', '
 On success, returns an array of file paths chosen by the user, otherwise
 returns `undefined`.
 
+The `filters` specifies an array of file types that can be displayed or
+selected, an example is:
+
+```javascript
+{
+  filters: [
+    { name: 'Images', extensions: ['jpg', 'png', 'gif'] },
+    { name: 'Movies', extensions: ['mkv', 'avi', 'mp4'] },
+    { name: 'Custom File Type', extensions: ['as'] },
+  ],
+}
+```
+
 If a `callback` is passed, the API call would be asynchronous and the result
 would be passed via `callback(filenames)`
 
@@ -41,11 +55,15 @@ be showed.
 * `options` Object
   * `title` String
   * `defaultPath` String
+  * `filters` Array
 * `callback` Function
 
 On success, returns the path of file chosen by the user, otherwise returns
 `undefined`.
 
+The `filters` specifies an array of file types that can be displayed, see
+`dialog.showOpenDialog` for an example.
+
 If a `callback` is passed, the API call would be asynchronous and the result
 would be passed via `callback(filename)`