Skip to content

Commit

Permalink
state.js: replace polyfills with js natives.. (#11873)
Browse files Browse the repository at this point in the history
This is a follow on from commit github.com/linuxmint/cinnamon/commit/e4b39d33273cdf5f83f786063a68de5e437db18b
  • Loading branch information
fredcw authored Sep 28, 2023
1 parent e4b39d3 commit 56718fd
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions js/misc/state.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const {find, filter} = imports.misc.util;

function intersect(array1, array2, difference = false) {
let result = [];
Expand Down Expand Up @@ -228,7 +227,7 @@ function createStore(state = {}, listeners = [], connections = 0) {

function trigger() {
const [key, ...args] = Array.from(arguments);
let matchedListeners = filter(listeners, function(listener) {
let matchedListeners = listeners.filter(function(listener) {
return listener.keys.indexOf(key) > -1 && listener.callback;
});
if (matchedListeners.length === 0) {
Expand All @@ -247,7 +246,7 @@ function createStore(state = {}, listeners = [], connections = 0) {
let listener;

if (callback) {
listener = find(listeners, function(listener) {
listener = listeners.find(function(listener) {
return listener.callback === callback;
});
}
Expand Down Expand Up @@ -276,7 +275,7 @@ function createStore(state = {}, listeners = [], connections = 0) {
}

function disconnectByKey(key) {
let listener = filter(listeners, function(listener) {
let listener = listeners.filter(function(listener) {
return listener.keys.indexOf(key) > -1;
});
let listenerIndex = listeners.indexOf(listener);
Expand Down

0 comments on commit 56718fd

Please sign in to comment.