Skip to content
This repository was archived by the owner on Jan 27, 2024. It is now read-only.

Conversation

SalesforceBobLightning
Copy link

Hi Doug,

I've got a working Lightning Web Component, I thought you might be interested in reviewing and adding to your repo?

Best

SBL

@douglascayers
Copy link
Owner

douglascayers commented Jul 25, 2019

Thanks, @SalesforceBobLightning. I'll review it when I get some time. Thanks again for taking this on =)

@douglascayers
Copy link
Owner

Fixes #5

@douglascayers douglascayers self-requested a review July 25, 2019 02:07
@douglascayers douglascayers added the enhancement ✨ A new feature suggestion or improvement upon an existing feature. label Jul 25, 2019
@ClayChipps
Copy link

@douglascayers Hey Doug, did you have a chance to review this PR? Looking to implement this library for LWC. Thanks!

@anandbn
Copy link

anandbn commented Jul 5, 2020

@SalesforceBobLightning - would be great if this included an example of invoking the LWC component from another LWC component vs. Aura.

I don't think LWC offers the same means of compoent.find('').restApi() as Aura. I'm thinking either expose a Javascript util class that does this, or use Lightning Message service to essentially make a request and send a response. I like the LMS approach as then this component can be standalone.

@douglascayers @ctchipps

@ClayChipps
Copy link

@anandbn You can call a method on a component in the same idea of Aura's component.find(), but using the template.querySelector() pattern. It would be interesting to see what (if any) of this library could be refactored using LMS.

@anandbn
Copy link

anandbn commented Jul 6, 2020

@ctchipps - never knew that was possible :). Never cease to learn new things.

@anandbn
Copy link

anandbn commented Jul 7, 2020

@ctchipps - i deployed the LWC version it seems to not set the child correctly and hence the restrequest method is failing.

            this.penpalInitialized = true;

            try {
              // eslint-disable-next-line no-undef
              const connection = Penpal.connectToChild({
                // The iframe to which a connection should be made
                iframe: iframeElmt
              });
              //connection is established
              this._penpal.connection = connection;
              connection.promise.then(function (child) {
                //LOOK HERE
                // this function never gets called neither does the error function.
                self._penpal.child = child;
              }).catch(function (err) {
                console.error('LWC_API: Error establishing connection to iframe', err);
                self.penpalInitialized = false;
              });
            } catch (error) {
              console.log(JSON.stringify(error));
            }
          } // else, iframe source is empty, keep waiting

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement ✨ A new feature suggestion or improvement upon an existing feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants