How to use the ember-intl/utils/streams.read function in ember-intl

To help you get started, weā€™ve selected a few ember-intl 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 ember-intl / ember-intl / addon / helpers / -base-legacy.js View on Github external
formatter,
        seenValue,
        extend({
          locale: get(intl, '_locale')
        }, format, seenHash),
        get(intl, 'formats')
      );
    });

    function notify() {
      if (out) {
        out.notify();
      }
    }

    if (value && value.isStream && read(value) instanceof LiteralWrapper) {
      value.subscribe(notify, out);
    }

    Object.keys(hash).forEach(function(key) {
      let hashValue = hash[key];

      if (hashValue && hashValue.isStream) {
        hashValue.subscribe(notify, out);
      }
    });

    if (value.isStream) {
      value.subscribe(notify, out);
    }

    view.one('willDestroyElement', () => {
github ember-intl / ember-intl / addon / helpers / -base-legacy.js View on Github external
let out = new Stream(() => {
      let seenHash = readHash(hash);
      let seenValue = read(value);
      let format = {};

      if (seenValue && seenValue instanceof LiteralWrapper) {
        seenValue = seenValue.value;
      }

      if (optionalReturnEmpty && optionalReturnEmpty(seenValue, seenHash)) {
        return;
      }

      if (seenHash && seenHash.format) {
        format = intl.getFormat(formatType, seenHash.format);
      }

      return formatter.format.call(
        formatter,