Giter VIP home page Giter VIP logo

Comments (5)

jaredpalmer avatar jaredpalmer commented on June 4, 2024

not really. Just reverse engineered it with chrome dev tools and determination hehe πŸ˜‰. The empty div and height of 1px does some forced layout within the scrollable chat area that’s super performant IIRC.

from disco.chat.

jaredpalmer avatar jaredpalmer commented on June 4, 2024

Just curious, how close are the iframe techniques used in disco to how you do it at live chat?

from disco.chat.

Andarist avatar Andarist commented on June 4, 2024

πŸ˜‰

at the moment we have initialization script installed by our customers which creates an iframe containing React app. The initialization script has also some other, mainly imperative, logic - but it's pretty small. The React app renders both minimized and maximized states and holds connection, most of our business logic etc.

We had pretty terrible experiences in the past with running code on our clients' sites (i.e. mootools installed, but also many other issues) - so we've decided to do as least as possible in this initialization script (truth to be told it doesn't handle initialization only, so maybe I shouldnt call it that, but whatever). This comes with a price though - when we do app resizing (maximized <-> minimized transitions) we have to postpone actual transition, send a resize request up to a parent page and resize upon receiving confirmation. It sounds terrible, but is just a matter of orchestrating few promises and for the user it seems instantaneous anyway.

Other than that we have to sync some states between both scripts (stockroom-style).

Interesting possible technique (which we dont use at the moment) is creating src-less (about:blank) iframe with js script tag in it to create a separate, isolated JS context there, but at the same time it being src-less grants access to parent's page DOM. So it can act as isolated logic hub and still manipulate main page content synchronously.

For security reasons though we also want things like localStorage isolated and combining both src-less iframe technique with regular iframe from our domain seemed to much of a hassle at this point.

Your preact/react combo is also neat, we've considered doing it that way too. Each technique has its own pros and cons though, hard to decide what's best πŸ˜‰

from disco.chat.

jaredpalmer avatar jaredpalmer commented on June 4, 2024

@Andarist Thanks for that response. Based on what you've described, and my reverse engineering spidey sense, I think Intercom does a similar thing.

from disco.chat.

Andarist avatar Andarist commented on June 4, 2024

Yeah, I think Intercom uses src-less iframes (without any iframe in their domain) and renders sometimes multiple of them to minimize non-clickable transparent area for non-rectangular "layouts" (and CSS isolation etc ofc).

from disco.chat.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.