shake = function shake(e) {
          if (!e.data.postmate) {
            return;
          }

          if (e.data.postmate === 'handshake') {
            {
              log('Child: Received handshake from Parent');
            }

            _this5.child.removeEventListener('message', shake, false);

            {
              log('Child: Sending handshake reply to Parent');
            }

            e.source.postMessage({
              postmate: 'handshake-reply',
              type: messageType
            }, e.origin);
            _this5.parentOrigin = e.origin; // Extend model with the one provided by the parent

            var defaults = e.data.model;

            if (defaults) {
              Object.keys(defaults).forEach(function (key) {
                _this5.model[key] = defaults[key];
              });

              {
                log('Child: Inherited and extended model from Parent');
              }
            }

            {
              log('Child: Saving Parent origin', _this5.parentOrigin);
            }

            return resolve(new ChildAPI(_this5));
          }

          return reject('Handshake Reply Failed');
        }
Responds to a handshake initiated by the Parent
@return {Promise} Resolves an object that exposes an API for the Child