PageSourceSearch

https://elastos-wiki.netlify.app/assets/js/14cc4f2d.1366d4d1.js

js elastos-wiki.netlify.app collected 2026-10-03 10:44:33 UTC 5,527 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[6666],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},p="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},w=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),p=l(n),w=a,m=p["".concat(c,".").concat(w)]||p[w]||u[w]||o;return n?r.createElement(m,i(i({ref:t},d),{},{components:n})):r.createElement(m,i({ref:t},d))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=w;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s[p]="string"==typeof e?e:a,i[1]=s;for(var l=2;l<o;l++)i[l]=n[l];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}w.displayName="MDXCreateElement"},8401:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>c,default:()=>m,frontMatter:()=>s,metadata:()=>l,toc:()=>p});var r=n(7462),a=n(3366),o=(n(7294),n(3905)),i=["components"],s={title:"The Built-in Connector Standard"},c=void 0,l={unversionedId:"sdk/general/connectivity/connectors/standard",id:"sdk/general/connectivity/connectors/standard",title:"The Built-in Connector Standard",description:"The Javascript window.elastos instance",source:"@site/../docs/7.sdk/general/connectivity/connectors/standard.md",sourceDirName:"7.sdk/general/connectivity/connectors",slug:"/sdk/general/connectivity/connectors/standard",permalink:"/sdk/general/connectivity/connectors/standard",draft:!1,editUrl:"https://github.com/elastos/Elastos.Wiki/edit/master/website/../docs/7.sdk/general/connectivity/connectors/standard.md",tags:[],version:"current",lastUpdatedBy:"racollette",lastUpdatedAt:1676425989,formattedLastUpdatedAt:"Feb 15, 2023",frontMatter:{title:"The Built-in Connector Standard"},sidebar:"sdkSidebar",previous:{title:"Manage Connectors",permalink:"/sdk/general/connectivity/guides/manage-connectors"},next:{title:"The Essentials Connector",permalink:"/sdk/general/connectivity/connectors/essentials"}},d={},p=[{value:"The Javascript window.elastos instance",id:"the-javascript-windowelastos-instance",level:2},{value:"How to detect if we are in a specific built-in browser?",id:"how-to-detect-if-we-are-in-a-specific-built-in-browser",level:3}],u={toc:p},w="wrapper";function m(e){var t=e.components,n=(0,a.Z)(e,i);return(0,o.kt)(w,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h2",{id:"the-javascript-windowelastos-instance"},"The Javascript window.elastos instance"),(0,o.kt)("p",null,"In javascript environments (using the Connectivity SDK JS), ",(0,o.kt)("strong",{parentName:"p"},"mobile wallets")," supporting Elastos features - such as Elastos Essentials - define the global window.elastos instance in their in-app browser, similarly to window.ethereum used to inject Ethereum Web3 providers."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},(0,o.kt)("em",{parentName:"strong"},"Window.elastos replaces other connectors"))),(0,o.kt)("p",null,"When window.elastos is defined (injected by the parent native browser or plugin), ",(0,o.kt)("strong",{parentName:"p"},"the connectivity SDK uses it automatically"),". Other connectors added by dApps are not used in such case."),(0,o.kt)("admonition",{type:"warning"},(0,o.kt)("p",{parentName:"admonition"},"window.elastos is not window.ethereum")),(0,o.kt)("p",null,"If you are used to write Ethereum web3 apps, you may have used window.ethereum as a web3 instance to execute Ethereum requests."),(0,o.kt)("p",null,'Elastos\' window.elastos is similar, but used to pass Elastos specific commands such as DI
1D credential requests (eg: requestCredentials(), to "sign in with DID")\nWhen a dApp is running inside a mobile wallet application such as Elastos Essentials, both window.ethereum and window.elastos are defined.'),(0,o.kt)("h3",{id:"how-to-detect-if-we-are-in-a-specific-built-in-browser"},"How to detect if we are in a specific built-in browser?"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},'// We are in the "Essentials" browser\nif (window.elastos.name === "essentialsiab") {\n ...\n}\n')))}m.isMDXComponent=!0}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.