How to use the knockout.unwrap function in knockout

To help you get started, we’ve selected a few knockout examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cloudera / hue / desktop / core / src / desktop / js / ko / bindings / ko.datalist.js View on Github external
function getVal(rawItem, prop) {
    const item = ko.unwrap(rawItem);
    return item && prop ? ko.unwrap(item[prop]) : item;
  }
github Sebazzz / financial-app / src / App / js / AppFramework / BindingHandlers / Href.ts View on Github external
() => {
                const options = ko.unwrap(valueAccessor());
                if (!isRouteOptions(options)) {
                    element.href = options;
                    return;
                }

                const $app = bindingContext.$root as App,
                    href = $app.router.getRoute(options.route, ko.toJS(options.params));

                element.href = href;
            },
            null,
github Sebazzz / financial-app / src / App / js / AppFramework / BindingHandlers / Href.ts View on Github external
() => {
                let options = ko.unwrap(valueAccessor());
                if (!isRouteOptions(options)) {
                    options = {
                        route: options
                    } as IRouteOptions;
                }

                const $app = bindingContext.$root as App,
                    href = $app.router.getRoute(options.route, ko.toJS(options.params));

                element.href = href;
            },
            null,
github cloudera / hue / desktop / core / src / desktop / js / ko / bindings / ko.publish.js View on Github external
return function() {
          const topicDetails = ko.unwrap(valueAccessor());
          if (typeof topicDetails === 'string') {
            huePubSub.publish(topicDetails);
          } else if (typeof topicDetails === 'object') {
            const keys = Object.keys(topicDetails);
            if (keys.length === 1) {
              huePubSub.publish(keys[0], topicDetails[keys[0]]);
            }
          }
        };
      },

knockout

Knockout makes it easier to create rich, responsive UIs with JavaScript

MIT
Latest version published 4 years ago

Package Health Score

62 / 100
Full package analysis