lib/starter_web/assets/themes/j1/adapter/js/framer.js in j1_template-2019.4.8 vs lib/starter_web/assets/themes/j1/adapter/js/framer.js in j1_template-2019.4.10
- old
+ new
@@ -77,11 +77,10 @@
j1.adapter['framer'] = (function (j1, window) {
{% comment %} Set global variables
------------------------------------------------------------------------------ {% endcomment %}
var environment = '{{environment}}';
- var state = 'not started';
var moduleOptions = {};
var _this;
var logger;
var logText;
@@ -96,10 +95,12 @@
// -------------------------------------------------------------------------
// Initializer
// -------------------------------------------------------------------------
init: function ( options ) {
+ // initialize state flag
+ j1.adapter.framer.state = 'pending';
// -----------------------------------------------------------------------
// Default module settings
// -----------------------------------------------------------------------
var settings = $.extend({
@@ -110,23 +111,23 @@
{% comment %} Load module config from yml data
-------------------------------------------------------------------------- {% endcomment %}
// Load module DEFAULTS|CONFIG
//
moduleOptions = $.extend({}, {{framer_options | replace: '=>', ':' | replace: 'nil', '""'}});
-
- if ( typeof settings !== 'undefined') {
+
+ if ( typeof settings !== 'undefined') {
moduleOptions = j1.mergeData( moduleOptions, settings );
- }
+ }
{% comment %} Set global variables
-------------------------------------------------------------------------- {% endcomment %}
- _this = j1.adapter.framer;
+ _this = j1.adapter.framer;
logger = log4javascript.getLogger('j1.adapter.framer');
- state = 'started';
- logger.info('state: ' + state);
- logger.info('Module is being initialized');
+ _this.setState('started');
+ logger.info('state: ' + _this.getState());
+ logger.info('module is being initialized');
iFrameResize({
log: moduleOptions.settings.log,
autoResize: moduleOptions.autoResize,
bodyBackground: moduleOptions.bodyBackground,
@@ -153,21 +154,23 @@
// -------------------------------------------------------------------------
// messageHandler: MessageHandler for J1 CookieConsent module
// Manage messages send from other J1 modules
// -------------------------------------------------------------------------
- messageHandler: function ( sender, message ) {
- var json_message = JSON.stringify(message, undefined, 2);
-
+ messageHandler: function ( sender, message ) {
+ var json_message = JSON.stringify(message, undefined, 2);
+
logText = 'Received message from ' + sender + ': ' + json_message;
logger.debug(logText);
// -----------------------------------------------------------------------
// Process commands|actions
// -----------------------------------------------------------------------
if ( message.type === 'command' && message.action === 'module_initialized' ) {
- _this.setState('finished');
+ //
+ // Place handling of command|action here
+ //
logger.info(message.text);
}
//
// Place handling of other command|action here
@@ -175,25 +178,27 @@
return true;
}, // END messageHandler
// -------------------------------------------------------------------------
- // Set the current (processing) state of the module
+ // setState
+ // Set the current (processing) state of the module
// -------------------------------------------------------------------------
- setState: function ( stat ) {
- state = stat;
+ setState: function (stat) {
+ j1.adapter.scroller.state = stat;
}, // END setState
// -------------------------------------------------------------------------
- // Returns the current (processing) state of the module
+ // getState
+ // Returns the current (processing) state of the module
// -------------------------------------------------------------------------
getState: function () {
- return state;
+ return j1.adapter.scroller.state;
} // END state
}; // END return
})(j1, window);
{% endcapture %}
{{ cache | strip_empty_lines }}
-{% assign cache = nil %}
\ No newline at end of file
+{% assign cache = nil %}