Skip to content

Instantly share code, notes, and snippets.

@jenter
Created December 8, 2016 16:01
Show Gist options
  • Select an option

  • Save jenter/714cda2cf097563b5363a1771b99b841 to your computer and use it in GitHub Desktop.

Select an option

Save jenter/714cda2cf097563b5363a1771b99b841 to your computer and use it in GitHub Desktop.

Revisions

  1. Jason Enter created this gist Dec 8, 2016.
    15 changes: 15 additions & 0 deletions D8 Drupal Behaviors (on page load)
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    (function ($, Drupal, window, document) {
    'use strict';

    // Example of Drupal behavior loaded.
    Drupal.behaviors.exampleJS = {
    attach: function (context, settings) {
    if (typeof context['location'] !== 'undefined') { // Only fire on document load.

    console.log('This is loaded');

    }
    }
    };

    })(jQuery, Drupal, this);