Giter VIP home page Giter VIP logo

intercom.js's People

Contributors

adamjmurray avatar brianreavis avatar edude03 avatar lewisjellis avatar marksort avatar thisandagain avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

intercom.js's Issues

Not works correctly in IE8+

Here is small sample:
http://jsbin.com/ayepiLe/1/

just open 4 tabs in any ie. Then move on 3rd for example. press login button. Depending on some random not all tabs have alert generated but 4th tab never fires anyway. have tried to use timeouts, replace alert on other methods (to not block) etc. without any success.

[enhancement] Add missing bower.json.

Hey, maintainer(s) of diy/intercom.js!

We at VersionEye are working hard to keep up the quality of the bower's registry.

We just finished our initial analysis of the quality of the Bower.io registry:

7530 - registered packages, 224 of them doesnt exists anymore;

We analysed 7306 existing packages and 1070 of them don't have bower.json on the master branch ( that's where a Bower client pulls a data ).

Sadly, your library diy/intercom.js is one of them.

Can you spare 15 minutes to help us to make Bower better?

Just add a new file bower.json and change attributes.

{
  "name": "diy/intercom.js",
  "version": "1.0.0",
  "main": "path/to/main.css",
  "description": "please add it",
  "license": "Eclipse",
  "ignore": [
    ".jshintrc",
    "**/*.txt"
  ],
  "dependencies": {
    "<dependency_name>": "<semantic_version>",
    "<dependency_name>": "<Local_folder>",
    "<dependency_name>": "<package>"
  },
  "devDependencies": {
    "<test-framework-name>": "<version>"
  }
}

Read more about bower.json on the official spefication and nodejs semver library has great examples of proper versioning.

NB! Please validate your bower.json with jsonlint before commiting your updates.

Thank you!

Timo,
twitter: @versioneye
email: [email protected]
VersionEye - no more legacy software!

Create version without Socket.io bindings

Create basic version without Socket.io binding, as it is not used by everyone and will reduce file size.

Another solution would be to move binding to another file and treat it as extension.

Implement Broadcast Channel API

Recently I found this docs that allowing us to communicate between tabs and iframes with a single broadcast channel.

I think it would be better if it was implemented to intercom.js.

And if the Broadcast Channel API was unavailable on the browser, then fallback to Local Storage.

General approach for resource sharing

Above all, thanks for the implementation, it is always great when you don't have to reinvent the wheel! :-) (I had come to the same approach in this topic: http://stackoverflow.com/questions/19125823/how-is-it-possible-to-share-single-js-resource-between-browser-tabs/19165781#19165781)

I think intercom.js is a good thing, but I think it would be more flexible if you'd step back and watch the problem in a more general way. It's about resource sharing and resource allocation, so I think it should not be so specific that you can have only a single resource of a single type (socket.io) . I suggest to create a more general interface for resource sharing, and a more general implementation of it. (Ofc shared webworkers would be that, but they are not supported in most of the browsers:S)

Controlling cleanup

First of all thank you for such an awesome tool, it was very useful in our case!

I was wondering about cleaning up LocalStorage.
I noticed these variables in intercom.js

var THRESHOLD_TTL_EMIT = 50000;
var THRESHOLD_TTL_ONCE = 1000 * 3600;

Could you please explain how often currently cleanup happens and how these two variables differ?
And can we change these settings, to do it more often?
Thank you.

Add support for socket.io v1

The following change can solve the compatibility issue

SocketBinding.factory = function(object, options, intercom) {
        if (typeof object.io === 'undefined' && object.connected == true) { 
            return false 
        };
        return new SocketBinding(object, options, intercom);
    };
}

Edge

Hi, has anyone got this library working in Edge? As far as I can tell it fails silently?

Does Intercom.js require Node.js or Socket.io

From the introduction it says that intercom.js includes a binding for socket.io, but doesn't elaborate if it's a requirement for it to work... or if node.js is required.

Also what is the main difference between socket.io and intercom.js?

Thanks

Publish on NPM

Currently it looks like this library is not published on NPM. Could you guys do that so we don't have to commit vendor code to our apps?

Fallback plan for browsers that disable localStorage?

Uncaught TypeError: Cannot call method 'getItem' of null
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36

Here is the null.getItem() call:
https://github.com/diy/intercom.js/blob/master/lib/intercom.js#L38

Here is where I think we could change this:
https://github.com/diy/intercom.js/blob/master/lib/localstorage.js#L2

Perhaps we should check if localstorage is falsy in addition to undefined?

Get old messages in newly opened window

I am wondering whether we can get the previously broadcast-ed messages in a newly opened window. For eg, I have broadcast-ed "message1" now and after sometime I opened a new window, then the new window should be able to get "message1". The same thing as we get in facebook chat.

Thanks.

Support master callback

I propose an optional callback be passed to getInstance method.
This callback will be called only if there are no previous getInstance invocation in other sessions. The moment the master instance is destroyed, either manually or when window closed, another instance must run the callback.

One use case is master socket connection transfer to other window when the master is closed.

Issue with IFrames and MS Edge

Running into an issue with MS Edge on Windows 10.

Basically the IFrame children can't communicate with the parent, here is a working example.

IE11 on Windows 7:
image

MS Edge on Windows 10:
capture

File1: TestPage.html

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Test Outside</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/intercom.js/0.1.4/intercom.min.js"></script>
    <script type="text/javascript">
        var intercom = Intercom.getInstance();

        intercom.on('parent', function(data) {
            document.getElementById("data").innerHTML = data.message;
        });

        setTimeout(function(){
            intercom.emit('child', {message: 'Hello, Son!'});
        }, 500);
    </script>
</head>
<body>
    <h1>Outside</h1>
    <p id="data">Loading..</p>
    <iframe src="/TestPage2.html"></iframe>
</body>
</html>

File2: TestPage2.html

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Test Inside</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/intercom.js/0.1.4/intercom.min.js"></script>
    <script type="text/javascript">
        var intercom = Intercom.getInstance();

        intercom.emit('parent', {message: 'Hello, Dad!'});

        intercom.on('child', function(data) {
            document.getElementById("data").innerHTML = data.message;
        });
    </script>
</head>
<body>
    <h1>Inside</h1>
    <p id="data">Loading..</p>
</body>
</html>

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.