7 examples of 'javascript attach' in JavaScript

Every line of 'javascript attach' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
12attach: function attach(context, settings) {
13 $('[data-proxy-click]', context).once('tome-proxy-click').on('click', function () {
14 $(this).find('[data-proxy-click-target] a')[0].click();
15 });
16}
10attach: function attach(context) {
11 $('.js-click-to-select-trigger', context).once('media-library-click-to-select').on('click', function (event) {
12 event.preventDefault();
13
14 var $input = $(event.currentTarget).closest('.js-click-to-select').find('.js-click-to-select-checkbox input');
15 $input.prop('checked', !$input.prop('checked')).trigger('change');
16 });
17 $('.js-click-to-select-checkbox input', context).once('media-library-click-to-select').on('change', function (_ref) {
18 var currentTarget = _ref.currentTarget;
19
20 $(currentTarget).closest('.js-click-to-select').toggleClass('checked', $(currentTarget).prop('checked'));
21 });
22}
21attach: function attach(context) {
22 $('.media-library-item .js-click-to-select-checkbox input', context).once('media-library-item-focus').on('focus blur', function (_ref2) {
23 var currentTarget = _ref2.currentTarget,
24 type = _ref2.type;
25
26 $(currentTarget).closest('.media-library-item').toggleClass('is-focus', type === 'focus');
27 });
28}
10attach: function attach(context) {
11 var $view = $('.js-media-library-view', context).once('media-library-select-all');
12 if ($view.length && $view.find('.js-media-library-item').length) {
13 var $checkbox = $('').on('click', function (_ref) {
14 var currentTarget = _ref.currentTarget;
15
16 var $checkboxes = $(currentTarget).closest('.media-library-view').find('.js-media-library-item input[type="checkbox"]');
17 $checkboxes.prop('checked', $(currentTarget).prop('checked')).trigger('change');
18
19 var announcement = $(currentTarget).prop('checked') ? Drupal.t('Zero items selected') : Drupal.t('All @count items selected', {
20 '@count': $checkboxes.length
21 });
22 Drupal.announce(announcement);
23 });
24 var $label = $('').text(Drupal.t('Select all media'));
25 $label.prepend($checkbox);
26 $view.find('.js-media-library-item').first().before($label);
27 }
28}
217function attach() {
218
219 if (attached) {
220 return false;
221 }
222
223 if (OS_IOS) {
224 __parentSymbol.headerPullView = $.view.ptr;
225 }
226
227 init();
228
229 return true;
230}
36hook.callback.attach(function callbackAttach(name, callback) {
37 hook.callback.deattach(callbackAttach);
38
39 t.equal(name, 'fs.open', 'name argument in .attach is fs.open');
40 t.equal(callback, openCallback, 'callback argument match input');
41
42 // set a new callback
43 return function (err, fd) {
44 t.equal(err, null, 'no error passed to patch callback');
45 t.type(fd, 'number', 'fd argument passed to patch callback is a number');
46 t.equal(callOrder++, 0, 'pached callback is executed first');
47
48 // chain the callback
49 return callback.apply(this, arguments);
50 };
51});
29attach() {
30 return new Promise(res => {
31 if (!this.connection) {
32 const target = { tabId: this.tabId }
33 chrome.debugger.attach(target, DEBUGGER_PROTOCOL_VERSION, () => {
34 this.connection = target
35 res(this.connection)
36 })
37 } else {
38 res(this.connection)
39 }
40 })
41}

Related snippets