webpack-bootstrap-ui-kit/src/js_old/place_it_to_types_folder_Pa...

64 lines
1.5 KiB
JavaScript
Raw Normal View History

/*
***************************************************************
* *** PAGE SPECIFIC CODDING ***
* Place it into app/client/src/js/types
* Require page specific css as mentioned bellow
*
* If you don't need page specific JS (only CSS)
* you can create SCSS file at app/client/src/scss/types
* !!! BUT NOT BOTH at "types" folder !!!
***************************************************************
*
* An example of Page specific JS and Mapbox functionality
* Take a look to app/templates/Objects/Map.ss for HTML
* Take a look to https://github.com/a2nt/silverstripe-mapboxfield/blob/master/README.md for Data Structure
*/
2022-05-03 20:50:57 +02:00
'use strict'
// your page specific css
2022-05-03 20:50:57 +02:00
import '../scss/_types/PageTypeClassName.scss'
2022-05-03 20:50:57 +02:00
import $ from 'jquery'
import Events from '../_events'
// Mapbox API
2022-05-03 20:50:57 +02:00
import '../_components/_ui.map.api'
const PageTypeUI = (($) => {
// Constants
2022-05-03 20:50:57 +02:00
const W = window
const D = document
const $Body = $('body')
2022-05-03 20:50:57 +02:00
const NAME = 'PageTypeUI'
class PageTypeUI {
// Static methods
2022-05-03 20:50:57 +02:00
static init () {
this.dispose()
console.log(`Initializing: ${NAME}`)
// custom page specific functionality
}
2022-05-03 20:50:57 +02:00
static initMap () {
// custom map functionality
}
2022-05-03 20:50:57 +02:00
static dispose () {
console.log(`Destroying: ${NAME}`)
}
}
$(W).on(`${Events.AJAX} ${Events.LOADED}`, () => {
2022-05-03 20:50:57 +02:00
PageTypeUI.init()
})
$(W).on(Events.MAPLOADED, () => {
2022-05-03 20:50:57 +02:00
PageTypeUI.initMap()
})
2022-05-03 20:50:57 +02:00
return PageTypeUI
})($)
2022-05-03 20:50:57 +02:00
export default PageTypeUI