Skip to content

Instantly share code, notes, and snippets.

View kumaraksi's full-sized avatar

Akshay Kumar kumaraksi

  • Payrails
  • Berlin
View GitHub Profile

Keybase proof

I hereby claim:

  • I am kumaraksi on github.

  • I am kumaraksi (https://keybase.io/kumaraksi) on keybase.

  • I have a public key ASDSt5lRVR7uBQa59JsNLSNFrKZYmZBvoAR9W_NOR3yXxQo

@kumaraksi
kumaraksi / google-map-traditional.html
Created May 15, 2019 13:29
google map callback approach
<!DOCTYPE html>
<html>
<head>
<title>Simple Map</title>
<meta name="viewport" content="initial-scale=1.0">
<meta charset="utf-8">
<style>
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
@kumaraksi
kumaraksi / google-map-component-updated.js
Last active February 24, 2019 07:26
lazy load google maps updated web component
import {EventBus} from '../../EventBus';
import { GoogleMapScriptLoader } from "../../Service/gmapLoader";
export class GMap extends HTMLElement{
constructor(){
super();
const template = this.getTemplate();
const shadow = this.attachShadow({mode: 'open'});
shadow.appendChild(template.content.cloneNode(true));
@kumaraksi
kumaraksi / gmapLoader.js
Created February 24, 2019 07:03
Lazy load google maps dynamic script injector
import { loadScript } from './scriptLoader';
export class GoogleMapScriptLoader {
static instance;
url;
promise;
constructor(){
if(GoogleMapScriptLoader.instance){
return GoogleMapScriptLoader.instance
@kumaraksi
kumaraksi / index.js
Last active February 24, 2019 06:49
Lazy-load-gmap main file
import './components/gmaps/gmap';
import { EventBus } from "./EventBus";
window.addEventListener('load', function(){
EventBus.getInstance().emit('onLoad')
});
@kumaraksi
kumaraksi / eventbus.js
Created February 24, 2019 06:42
EventBus
export class EventBus{
static instance;
constructor(){
if(EventBus.instance){
return EventBus.instance
}
this.subscribers = [];
EventBus.instance = this;
}
static getInstance(){
export class GMap extends HTMLElement{
constructor(){
super();
const template = this.getTemplate();
const shadow = this.attachShadow({mode: 'open'});
shadow.appendChild(template.content.cloneNode(true));
}
getTemplate(){