These are chat archives for canjs/canjs

14th
May 2017
Nico R.
@nriesco
May 14 2017 00:00
before hook:
if (hook.params && hook.params.query && hook.params.query.superId !== undefined) {
      let id = hook.params.query.superId;
      delete hook.params.query.superId;
      if (ObjectID.isValid(id)) {
        hook.params.query._id = new ObjectID(id);
      } else {}
    }
after:
      hook.result.data.forEach(function(elem, index) {
        try {
          hook.result.data[index].superId = elem._id;
        } catch (e) {
          console.log('exception', e, e.message);
        }
      });
Julian
@pYr0x
May 14 2017 00:42
@bmomberger-bitovi very nice.. i will take a look and try to use it in my app. Thank you very much !
other question btw:
i have a DefineMap like:
const VM = DefineMap.extend({
  myPromise: "any",
  probeuntersuchung: {
    value: {},
    Type: {
      korrigiert: {
        value: false,
        get: function (lastVal, resolve) {
          this.myPromise.then(function (response) {
             resolve(response)
          });
        }
      }
    }
  }
});
how can i access the myPromise in the neseted Map of probeuntersuchung ?
this.myPromise is not working because the nested map doesnt know its parent
Frank Lemanschik
@frank-dspeed
May 14 2017 01:57
@pYr0x try get: (lastVal, resolve) => {
arrow functions could solve that i think as they have other this context
else you can also do .bind(this)
Julian
@pYr0x
May 14 2017 18:22
@frank-dspeed how would you add .bind to the clouser?
the context of this would be the object that is assigned to Type