How to use the @lrnwebcomponents/utils/utils.js.varGet function in @lrnwebcomponents/utils

To help you get started, we’ve selected a few @lrnwebcomponents/utils 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 elmsln / lrnwebcomponents / elements / hax-body / lib / hax-autoloader.js View on Github external
tag: name,
                properties: effectiveChildren[i].HAXWiring.getHaxProperties(),
                polymer: false
              }
            });
            context.dispatchEvent(evt);
          } else {
            // @todo support CDN failover or a flag of some kind to ensure
            // this delivers locally or from remote
            // @todo need to support name spacing of packages so that we
            // don't assume they are all relative to lrnwebcomponents
            const basePath = this.pathFromUrl(
              decodeURIComponent(import.meta.url)
            );
            if (!window.customElements.get(name)) {
              let nameLocation = varGet(
                window.HaxStore,
                "instance.__appStoreData.autoloader." + name,
                `@lrnwebcomponents/${name}/${name}.js`
              );
              import(`${basePath}../../../${nameLocation}`)
                .then(response => {
                  // get the custom element definition we used to add that file
                  let CEClass = window.customElements.get(name);
                  if (!CEClass) {
                    console.error(
                      `${name} was not a valid custom element yet a load was attempted`
                    );
                  } else if (typeof CEClass.getHaxProperties === "function") {
                    this.setHaxProperties(CEClass.getHaxProperties(), name);
                  } else if (typeof CEClass.HAXWiring === "function") {
                    this.setHaxProperties(
github elmsln / lrnwebcomponents / elements / haxor-slevin / haxor-slevin.js View on Github external
autorun(reaction => {
      this.activeTitle = toJS(store.activeTitle);
      this.shareUrl = document.location.href;
      this.shareMsg = this.activeTitle + " " + this.shareUrl;
      if (varGet(store.activeItem, "metadata.fields.subtitle", false)) {
        this.subtitle = store.activeItem.metadata.fields.subtitle;
      } else {
        this.subtitle = false;
      }
      // look for image on the post and make it the pin share
      if (varGet(store.activeItem, "metadata.fields.images.0.src", false)) {
        this.activeImage = store.activeItem.metadata.fields.images[0].src;
      }
      this.__disposer.push(reaction);
    });
  }
github elmsln / lrnwebcomponents / elements / haxcms-elements / lib / core / haxcms-site-store.js View on Github external
// build the children into a hierarchy too
      manifestItems.forEach((item, i) => {
        this._setChildren(item, manifestItems);
      });

      /**
       * Publish Pages Option
       *
       * This option enables the notion of published and unpublished pages.
       * To enable this option set manifest.metadata.site.settings.publishPagesOn = true
       *
       * By default all pages will be published unless "metadata.published" is set to "true" on the
       * item.
       */
      if (
        varGet(manifest, "metadata.site.settings.publishPagesOn", false) ===
        true
      ) {
        const filterHiddenParentsRecursive = item => {
          // if the item is unpublished then remove it.
          if (item.metadata.published === false) {
            return false;
          }
          // if the item has parents, recursively see if any parent is not published
          const parent = manifestItems.find(i => i.id === item.parent);
          if (parent) {
            return filterHiddenParentsRecursive(parent);
          }
          // if it got this far then it should be good.
          return true;
        };
        manifestItems = manifestItems.filter(i =>
github elmsln / lrnwebcomponents / elements / haxcms-elements / lib / core / haxcms-site-builder.js View on Github external
_manifestChanged(newValue, oldValue) {
    if (newValue && newValue.metadata && newValue.items) {
      // @todo replace this with a schema version mapper
      // once we have versions
      if (varExists(newValue, "metadata.siteName")) {
        let git = varGet(newValue, "publishing.git", {});
        newValue.metadata.site = {
          name: newValue.metadata.siteName,
          git: git,
          created: newValue.metadata.created,
          updated: newValue.metadata.updated
        };
        newValue.metadata.theme.variables = {
          image: newValue.metadata.image,
          icon: newValue.metadata.icon,
          hexCode: newValue.metadata.hexCode,
          cssVariable: newValue.metadata.cssVariable
        };
        newValue.metadata.node = {
          dynamicElementLoader: newValue.metadata.dynamicElementLoader,
          fields: newValue.metadata.fields
        };
github elmsln / lrnwebcomponents / elements / haxcms-elements / lib / ui-components / active-item / site-git-corner.js View on Github external
autorun(reaction => {
      if (
        varGet(store.manifest, "metadata.site.git.publicRepoUrl", "") != "" &&
        !window.customElements.get("git-corner")
      ) {
        import("@lrnwebcomponents/git-corner/git-corner.js");
      }
      this.__disposer.push(reaction);
    });
    autorun(reaction => {
github elmsln / lrnwebcomponents / elements / haxor-slevin / haxor-slevin.js View on Github external
autorun(reaction => {
      let manifest = toJS(store.manifest);
      this.title = varGet(manifest, "title", "");
      this.image = varGet(
        manifest,
        "metadata.theme.variables.image",
        "assets/banner.jpg"
      );
      this.icon = varGet(
        manifest,
        "metadata.theme.variables.icon",
        "icons:record-voice-over"
      );
      this.author = varGet(manifest, "metadata.author", {});
      this.__disposer.push(reaction);
    });
    autorun(reaction => {
github elmsln / lrnwebcomponents / elements / haxcms-elements / lib / ui-components / active-item / site-git-corner.js View on Github external
autorun(reaction => {
      if (store.activeItem) {
        this.activeGitFileLink =
          varGet(store.manifest, "metadata.site.git.publicRepoUrl", "") +
          store.activeItem.location;
      }
      this.__disposer.push(reaction);
    });
  }
github elmsln / lrnwebcomponents / elements / simple-blog / lib / simple-blog-header.js View on Github external
autorun(reaction => {
      let manifest = toJS(store.manifest);
      if (manifest && manifest.description) {
        this.description = manifest.description;
      }
      if (manifest && manifest.title) {
        this.title = manifest.title;
      }
      this.image = varGet(
        manifest,
        "metadata.theme.variables.image",
        "assets/banner.jpg"
      );
      this.icon = varGet(
        manifest,
        "metadata.theme.variables.icon",
        "icons:record-voice-over"
      );
      this.author = varGet(manifest, "metadata.author", {});
      this.__disposer.push(reaction);
    });
  }
github elmsln / lrnwebcomponents / elements / haxor-slevin / haxor-slevin.js View on Github external
autorun(reaction => {
      let manifest = toJS(store.manifest);
      this.title = varGet(manifest, "title", "");
      this.image = varGet(
        manifest,
        "metadata.theme.variables.image",
        "assets/banner.jpg"
      );
      this.icon = varGet(
        manifest,
        "metadata.theme.variables.icon",
        "icons:record-voice-over"
      );
      this.author = varGet(manifest, "metadata.author", {});
      this.__disposer.push(reaction);
    });
    autorun(reaction => {
github elmsln / lrnwebcomponents / elements / haxor-slevin / haxor-slevin.js View on Github external
autorun(reaction => {
      let manifest = toJS(store.manifest);
      this.title = varGet(manifest, "title", "");
      this.image = varGet(
        manifest,
        "metadata.theme.variables.image",
        "assets/banner.jpg"
      );
      this.icon = varGet(
        manifest,
        "metadata.theme.variables.icon",
        "icons:record-voice-over"
      );
      this.author = varGet(manifest, "metadata.author", {});
      this.__disposer.push(reaction);
    });
    autorun(reaction => {