Skip to content

Instantly share code, notes, and snippets.

@tobiasosDev
Last active July 19, 2019 06:08
Show Gist options
  • Select an option

  • Save tobiasosDev/845a20a35bc543ce8e2aab50486b8532 to your computer and use it in GitHub Desktop.

Select an option

Save tobiasosDev/845a20a35bc543ce8e2aab50486b8532 to your computer and use it in GitHub Desktop.

Revisions

  1. tobiasosDev revised this gist Jul 19, 2019. 1 changed file with 12 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions createMenuWithDefaultObject.js
    Original file line number Diff line number Diff line change
    @@ -8,6 +8,18 @@ function createMenu(config) {
    },
    config
    );
    // Alternative would be
    /*
    {
    {
    title: "Foo",
    body: "Bar",
    buttonText: "Baz",
    cancellable: true
    },
    ...config
    }
    */

    // config now equals: {title: "Order", body: "Bar", buttonText: "Send", cancellable: true}
    // ...
  2. tobiasosDev created this gist Jul 19, 2019.
    14 changes: 14 additions & 0 deletions createMenuWithDefaultObject.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    function createMenu(config) {
    config = Object.assign(
    {
    title: "Foo",
    body: "Bar",
    buttonText: "Baz",
    cancellable: true
    },
    config
    );

    // config now equals: {title: "Order", body: "Bar", buttonText: "Send", cancellable: true}
    // ...
    }