How to use the dojo/_base/lang.clone function in dojo

To help you get started, we’ve selected a few dojo 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 Esri / storymap-cascade / src / app / storymaps / tpl / view / media / WebMap.jsx View on Github external
computeSwipeLayers(previousWebMapLayers) {
    this._swipeLayersNodes = [];
    this._swipePreviousWebMapLayers = [];

    previousWebMapLayers = previousWebMapLayers || [];
    this._webmap.layers = this._webmap.layers || [];

    // The map hasn't loaded yet, save the list of previousWebMapLayers for after map has loaded
    if (! this._cache[this.id]) {
      this._swipePreviousWebMapLayers = lang.clone(previousWebMapLayers);
      return;
    }

    /*
     * Stringify the layers config so they are comparable
     */
    var previousLayersComparable = [],
        currentLayersComparable = [];

    for (let layer of previousWebMapLayers) {
      previousLayersComparable.push(JSON.stringify(layer));
    }

    for (let layer of this._webmap.layers) {
      currentLayersComparable.push(JSON.stringify(layer));
    }
github Esri / storymap-cascade / src / app / storymaps / tpl / builder / settings / Popup.jsx View on Github external
item.bookmark = item.bookmark.substr(0, BOOKMARK_MAX_CHARACTERS);
        return item;
      });

      // add "disabled" member for the UI -- but NOT to the original array!
      let bookmarkUI = this.data.settings.bookmarks.map(item => {
        return Object.assign({}, item, { disabled: item.status === 'disabled' });
      });

      let esriName = 'Esri';

      if (this.data.settings.orgLogoSettings.useOrgLogo && CommonHelper.isDefaultLogoLink(this.data.settings.logo.link)) {
        this.data.settings.logo.link = '';
      }

      let logoSharingData = lang.clone({
        settings: this.data.settings,
        background: this.data.context.headerBackground,
        maxCharacters: TAGLINE_MAX_CHARACTERS,
        strings: i18n.builder.headerConfig.logoSharing,
        useEsriLogoString: i18n.builder.headerConfig.logoSharing.logoButton.replace(/\${ESRI}/g, esriName),
        emptyTagline: !this.data.settings.link.title
      });

      logoSharingData.settings.logo.url = Media.addToken(logoSharingData.settings.logo.url);

      let bookmarkData = {
        bookmarks: bookmarkUI,
        maxCharacters: BOOKMARK_MAX_CHARACTERS,
        strings: i18n.builder.headerConfig.bookmarks
      };
github Esri / storymap-cascade / src / app / storymaps / tpl / view / media / Media.jsx View on Github external
serialize(type, media, includeInstanceID) {
    const serializedObject = lang.clone({
      type: type,
      [type]: media
    });

    const alternateMedia = this.getAlternate();
    if (alternateMedia) {
      serializedObject.alternate = alternateMedia.serialize(includeInstanceID);
      if (serializedObject.alternate && serializedObject.alternate.image) {
        this._addAlternateCaption(serializedObject[type], serializedObject.alternate.image);
        this._addAlternateSize(serializedObject[type], serializedObject.alternate.image);
      }
    }

    // include the instanceID if we are doing a scan.
    if (includeInstanceID && typeof serializedObject[type] === 'object') {
      serializedObject[type].instanceID = this._instanceID;
github Esri / storymap-cascade / src / app / storymaps / tpl / view / section / SequenceBuilder.jsx View on Github external
}
        }
      }

      this._section.foreground.blocks = blocks;
    }

    //
    // All serialize methods for medias and section deep clone the object
    //  Object.assign is not perforning deep cloning of properties
    // This is to avoid issues with a duplicated Sequential section where
    //  edits in one would be performed on both!
    // As the serialize method are called quite a bit in builder, it may
    //  be worthwile to optimize
    // TODO: optimize
    return lang.clone(this._section);
  }
github Esri / storymap-cascade / src / app / storymaps / tpl / view / section / CreditsBuilder.jsx View on Github external
// loop through each panel, serializing each one and writing the results to the panels object.
    for (let i = 0; i < this._panels.length; i++) {
      let panel = this._panels[i];
      if (panel.type === 'credits') {
        // have to get the serialize method from somewhere...
        panels.push(panel.credits.serialize(includeInstanceID));
      }
      else if (panel.type === 'blocks') {
        panels.push(this.serializeBlocks(panel, includeInstanceID));
      }
    }

    // write the panels to the section (via the foreground)
    this._section.foreground.panels = panels;

    return lang.clone(this._section);
  }
github Esri / storymap-cascade / src / app / storymaps / tpl / core / Controller.jsx View on Github external
label: 'Georgia',
      fontFamily: '\'Georgia\', \'Hoefler Text\', \'Palatino\', serif'
    }, {
      label: 'Arial',
      fontFamily: '\'Arial\', \'Helvetica Neue\', \'Helvetica\', sans-serif'
    }];

    const appFonts = lang.getObject('app.data.appItem.data.values.settings.theme.fonts');
    if (appFonts) {
      let found;
      if (appFonts.titleFont) {
        found = fonts.some(font => {
          return font.label === appFonts.titleFont.label;
        });
        if (!found) {
          fonts.push(lang.clone(appFonts.titleFont));
        }
      }
      if (appFonts.bodyFont) {
        found = fonts.some(font => {
          return font.label === appFonts.bodyFont.label;
        });
        if (!found) {
          fonts.push(lang.clone(appFonts.bodyFont));
        }
      }
    }
    return fonts;
  }
github Esri / storymap-cascade / src / app / storymaps / tpl / core / Controller.jsx View on Github external
textMain: '#4c4c4c'
    }, {
      id: 'white-on-black-1',
      label: i18n.viewer.theme.darkLabel,
      themeMajor: 'dark',
      themeContrast: 'light',
      bgMain: '#0E0E0E',
      textMain: '#DDD'
    }];
    const appColors = lang.getObject('app.data.appItem.data.values.settings.theme.colors');
    if (appColors) {
      const found = colors.some(color => {
        return color.id === appColors.id;
      });
      if (!found) {
        colors.push(lang.clone(appColors));
      }
    }
    return colors;
  }
github Esri / storymap-cascade / src / app / storymaps / tpl / core / Controller.jsx View on Github external
fonts.forEach(fontObj => {
      if (fontObj.label === bodyFontLabel) {
        bodyFont = lang.clone(fontObj);
      }
      if (fontObj.label === titleFontLabel) {
        titleFont = lang.clone(fontObj);
      }
    });
    return {bodyFont, titleFont};
github Esri / storymap-cascade / src / app / storymaps / tpl / view / section / Immersive / PanelBuilder.jsx View on Github external
for (var i=0; i < blocksSerialized.length; i++) {
        var editorBlock = blocksSerialized[i];

        if (editorBlock.type == 'media') {
          var block = this.findBlock(editorBlock.id);
          if (block) {
            blocksSerialized[i] = block.serialize(includeInstanceID);
          }
        }
      }

      this._blocksJSON = blocksSerialized;
    }

    return lang.clone({
      layout: this.layout,
      settings: this._settings,
      blocks: this._blocksJSON
    });
  }

dojo

Dojo core is a powerful, lightweight library that makes common tasks quicker and easier. Animate elements, manipulate the DOM, and query with easy CSS syntax, all without sacrificing performance.

BSD-3-Clause OR AFL-2.1
Latest version published 2 years ago

Package Health Score

59 / 100
Full package analysis