Git Product home page Git Product logo

Comments (2)

flowersinthesand avatar flowersinthesand commented on May 31, 2024

The above scope we discussed is called browsing context according to W3C's HTML5 spec and it seems that window.name is the only storage sharing its life cycle with browsing context. Since it is just the name of the window, our use case may be a misuse and not reliable but I couldn't find a better alternative or a unobtrusive solution.

For this feature, we need a new option, name?: string. name is an identifier of a socket within document and used to identify a specific socket in each document within browsing context. A user should define it explicitly as it can't have default value.

// A socket whose name is 'main' after page navigation will continue this socket's life cycle
cettia.open("/cettia", {name: "main"});

Actually, uri might be suitable as the default value of name option but if two sockets sharing the same uri exist in the same page or uri is generated programmatically e.g. cettia.open("/cettia?time=" + Date.now()), it won't work.

Now we need how to use window.name to get/set data indicating that which name corresponds to which socket.

from cettia-javascript-client.

flowersinthesand avatar flowersinthesand commented on May 31, 2024

Because a way depending on window.name itself is obstructive unlike cookie or session storage, there is no way to avoid conflicting with existing libraries using window.name. That's why it doesn't matter even if we monopolizes window.name. Of course user should be aware of that.

As for how to use window.name, window.name will be a JSON representation of an object whose key is name option and value is socket id. That's all.

from cettia-javascript-client.

Related Issues (20)

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.