37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
(function () {
|
||
'use strict';
|
||
|
||
var FLAG = 'lampa_plugin_template_started';
|
||
|
||
function start() {
|
||
if (window[FLAG]) return;
|
||
window[FLAG] = true;
|
||
|
||
// TODO: основная логика плагина
|
||
// Пример подписки на события:
|
||
// Lampa.Listener.follow('app', function (e) {
|
||
// if (e.type === 'ready') {
|
||
// console.log('[lampa-plugin] app ready');
|
||
// }
|
||
// });
|
||
|
||
// Пример расширения карточки (осторожно с переопределениями):
|
||
// if (window.Lampa && Lampa.Card && Lampa.Card.prototype) {
|
||
// var original = Lampa.Card.prototype.build;
|
||
// if (typeof original === 'function') {
|
||
// Lampa.Card.prototype.build = function () {
|
||
// original.apply(this, arguments);
|
||
// // TODO: post-build логика
|
||
// };
|
||
// }
|
||
// }
|
||
}
|
||
|
||
if (window.appready) {
|
||
start();
|
||
} else if (window.Lampa && Lampa.Listener) {
|
||
Lampa.Listener.follow('app', function (event) {
|
||
if (event.type === 'ready') start();
|
||
});
|
||
}
|
||
})(); |