Détail du package

@cocreate/observer

CoCreate-app134AGPL-3.01.18.2

Register a components init function & observe selector. The init function will be fired immedietly after detection of selector.

observer, cocreate, low-code-framework, no-code-framework

readme

CoCreate-observer

Register a components init function & observe selector. The init function will be fired immedietly after detection of selector. Take it for a spin in our playground!

minified gzip brotli GitHub latest release License Hiring

CoCreate-observer

Docs & Demo

For a complete guide and working demo refer to the doumentation

Table of Contents

## Code Examples

Installation

You can install CoCreate-observer using the following methods:

CDN

<script src="[https://cdn.cocreate.app/observer/latest/CoCreate-observer.min.js](https://cdn.cocreate.app/observer/latest/CoCreate-observer.min.js)"></script>

npm

$ npm i @cocreate/observer

yarn

$ yarn install @cocreate/observer

Code Examples

// Initialize an observer
CoCreate.observer.init({
    name: "my-observer",
    types: ["attributes"],
    selector: ".my-element",
    callback: function (mutation) {
        console.log("Mutation occurred:", mutation);
    }
});

Parameter Description

The init function takes a configuration object with the following key parameters:

  • name: A unique name for the observer.
  • types: An array of mutation types to observe (e.g., "childList", "attributes").
  • selector: A CSS selector to target elements.
  • callback: The function to be executed when a mutation is detected.

Announcements

All updates to this library are documented in our CHANGELOG and releases. You may also subscribe to email for releases and breaking changes.

Roadmap

If you are interested in the future direction of this project, please take a look at our open issues and pull requests. We are currently focused on improving performance for large-scale applications and adding support for custom mutation types. We would love to hear your feedback.

Contributing

We welcome contributions of all kinds, including bug fixes, new features, documentation improvements, and performance optimizations. We encourage community contributions to our libraries (you might even score some nifty swag), please see our CONTRIBUTING guide for details.

We want this library to be community-driven, and CoCreate led. We need your help to realize this goal. To help make sure we are building the right things in the right order, we ask that you create issues and pull requests or merely upvote or comment on existing issues or pull requests.

We appreciate your continued support, thank you!

About

CoCreate-observer is a JavaScript library that simplifies the process of monitoring changes in the DOM (Document Object Model). It provides a robust and efficient way to detect and respond to mutations, such as changes to attributes, additions or removals of nodes, and modifications to text content. CoCreate-observer allows developers to easily register callbacks that are triggered when specific elements matching a selector undergo the specified mutations.

Key features include:

  • Efficient selector matching
  • Debouncing to optimize performance
  • Flexible configuration options
  • Cross-browser compatibility

CoCreate-observer is part of the CoCreate suite of open-source tools designed to accelerate web development and empower developers to build dynamic, interactive applications more efficiently. CoCreate aims to provide a comprehensive and modular ecosystem for modern web development.

Please Email the Developer Experience Team here in case of any queries.

CoCreate-observer is maintained and funded by CoCreate. The names and logos for CoCreate are trademarks of CoCreate, LLC.

License

This software is dual-licensed under the GNU Affero General Public License version 3 (AGPLv3) and a commercial license.

  • Open Source Use: For open-source projects and non-commercial use, this software is available under the AGPLv3. The AGPLv3 allows you to freely use, modify, and distribute this software, provided that all modifications and derivative works are also licensed under the AGPLv3. For the full license text, see the LICENSE file.

  • Commercial Use: For-profit companies and individuals intending to use this software for commercial purposes must obtain a commercial license. The commercial license is available when you sign up for an API key on our website. This license permits proprietary use and modification of the software without the copyleft requirements of the AGPLv3. It is ideal for integrating this software into proprietary commercial products and applications.

Please ensure you understand and comply with the appropriate license terms for your use case.

changelog

1.18.2 (2025-05-01)

Bug Fixes

1.18.1 (2025-04-30)

Bug Fixes

  • added css-loader (4fb5afc)
  • exclude configs from firing callback (c5e9c91)
  • if type characterData and isConnected false return (0f6cb37)
  • update query attributes (0b017eb)
  • updated cocreate modules versions (bcef690)
  • webpack.config and devdependencies (0c99692)

1.18.0 (2025-04-11)

Bug Fixes

  • removed requestAnmationFrame (9547ac2)
  • update readme details (e20a14f)

Features

  • Refactor observer initialization and uninitialization for improved performance and clarity (e907964)

1.17.1 (2024-12-14)

Bug Fixes

1.17.0 (2024-11-04)

Bug Fixes

  • pretier.config.js and file formating (d9d97ea)

Features

  • add prettier.config.js and format files (2c5d1cb)
  • add prettier.config.js and format files (f0763f8)

1.16.5 (2024-11-02)

Bug Fixes

  • fetch array renamed to array (1448c98)
  • observer taget has been renamed to selector (9d27f28)
  • observer taget has been renamed to selector (c8583bb)

1.16.4 (2024-06-23)

Bug Fixes

1.16.3 (2024-06-23)

Bug Fixes

1.16.2 (2024-06-12)

Bug Fixes

1.16.1 (2024-04-29)

Bug Fixes

  • bump cocreate dependencies (cded19d)

1.16.0 (2024-01-08)

Features

  • bumped CoCreate dependencies to their latest versions (cc691e7)

1.15.0 (2023-11-25)

Bug Fixes

  • update licensing details (0366577)

Features

  • upgrade dependencies for latest features and fixes (3aca441)

1.14.0 (2023-11-25)

Bug Fixes

  • update nav, edit button and css path (91813a7)

Features

  • upgrade dependencies for latest features and fixes (968a490)

1.13.0 (2023-11-19)

Features

  • update dependecies for th latest features and bug fixes (cba7c9b)

1.12.0 (2023-11-16)

Bug Fixes

Features

  • support special selectors that end in [] (ff24e72)

1.11.10 (2023-11-12)

Bug Fixes

  • bump dependencies for latest features (ad26ed6)

1.11.9 (2023-11-09)

Bug Fixes

1.11.8 (2023-11-03)

Bug Fixes

  • favicon.ico path (d6acbe7)
  • update dependencies to the lates versions (75e1c5f)

1.11.7 (2023-10-25)

Bug Fixes

1.11.6 (2023-10-14)

Bug Fixes

1.11.5 (2023-10-09)

Bug Fixes

1.11.4 (2023-10-09)

Bug Fixes

1.11.3 (2023-10-09)

Bug Fixes

  • bump cocreate dependency versions (cfb9afe)

1.11.2 (2023-09-18)

Bug Fixes

  • Add path and pathname (9139089)
  • Update dCoCreate dpendencies to latest versions (162dff2)

1.11.1 (2023-08-21)

Bug Fixes

1.11.0 (2023-08-21)

Features

  • Update cocreate dependencies for the latest features and bug fixes (3ff477d)

1.10.1 (2023-08-21)

Bug Fixes

1.10.0 (2023-08-17)

Features

  • bump cocreate dependencies for the latest updates and features (a0916de)

1.9.0 (2023-08-16)

Bug Fixes

  • crud attributes renamed (ee2e299)
  • replace -target -selector (65ab604)
  • webpack.config and package.json make use of mode=production instead of process.env (21e65a5)

Features

  • name attribute and variable renamed to key (6cfeac1)
  • Refactor handleAddedNodes and handleRemovedNodes for improved mutation tracking. (b91f38f)

1.8.19 (2023-06-14)

Bug Fixes

1.8.18 (2023-06-11)

Bug Fixes

1.8.17 (2023-06-11)

Bug Fixes

1.8.16 (2023-06-11)

Bug Fixes

1.8.15 (2023-06-11)

Bug Fixes

1.8.14 (2023-06-11)

Bug Fixes

1.8.13 (2023-06-11)

Bug Fixes

1.8.12 (2023-06-11)

Bug Fixes

1.8.11 (2023-06-11)

Bug Fixes

1.8.10 (2023-06-11)

Bug Fixes

  • @cocreate/cli moved to dependencies (1e79950)

1.8.9 (2023-06-11)

Bug Fixes

1.8.8 (2023-06-11)

Bug Fixes

  • renamed hosts to host. the value can be a string or an array of strings (2c6ff4e)

1.8.7 (2023-06-10)

Bug Fixes

1.8.6 (2023-06-10)

Bug Fixes

1.8.5 (2023-06-04)

Bug Fixes

  • Refactor CoCreate.config.js to remove hard-coded credentials (87829c3)

1.8.4 (2023-06-04)

Bug Fixes

1.8.3 (2023-06-04)

Bug Fixes

1.8.2 (2023-06-04)

Bug Fixes

  • semantic-release: worklow error solved by running node version 14 (67bf8c0)

1.8.1 (2023-06-02)

Bug Fixes

1.8.0 (2023-05-27)

Features

  • Refactored observer function to add support for :has() and :not() selectors; improved code readability by using more descriptive variable names. (d1a451e)

1.7.10 (2023-05-21)

Bug Fixes

1.7.9 (2023-05-19)

Bug Fixes

  • update packages to latest version. This commit updates various packages in the dependencies section of the package.json file to their latest published versions, thereby fixing multiple bugs and improving overall performance. (0da216e)

1.7.8 (2023-05-10)

Bug Fixes

1.7.7 (2023-05-06)

Bug Fixes

1.7.6 (2023-05-01)

Bug Fixes

  • update manifest.json to manifest.webmanifest (def982f)

1.7.5 (2023-05-01)

Bug Fixes

  • replace fontawesome with svg (fb6d478)

1.7.4 (2023-04-30)

Bug Fixes

  • fullscreen target updated to fullscreen fullscreen-target (68c5937)
  • package-lock.json and pnpm-lock.yaml added to .gitignore (2aec4b2)
  • removed toogle fullscreen icons. now using css content (10eed61)

1.7.3 (2023-04-24)

Bug Fixes

  • updated worrkflows to v3 and node version 16 (e0166c2)
  • workflow node version updated 16 (78e9504)

1.7.2 (2023-04-24)

Bug Fixes

1.7.1 (2023-04-24)

Bug Fixes

  • removed uglify.js from dev dependencies (61a0df1)

1.7.0 (2023-04-24)

Features

1.6.8 (2023-04-13)

Bug Fixes

  • replaced object.entries with Object.keys (bf04429)

1.6.7 (2023-04-13)

Bug Fixes

  • replaced substr with substring (e44421a)

1.6.6 (2023-04-11)

Bug Fixes

1.6.5 (2023-04-11)

Bug Fixes

1.6.4 (2023-04-11)

Bug Fixes

  • renamed domans to hosts (a7d000a)

1.6.3 (2023-03-30)

Bug Fixes

1.6.2 (2023-03-16)

Bug Fixes

1.6.1 (2023-03-16)

Bug Fixes

1.6.0 (2023-03-16)

Features

  • replaced get-value and set-value with a super charged version of CoCreate-events (49ab800)

1.5.63 (2023-02-01)

Bug Fixes

1.5.62 (2023-01-31)

Bug Fixes

1.5.61 (2023-01-30)

Bug Fixes

1.5.60 (2023-01-29)

Bug Fixes

1.5.59 (2023-01-27)

Bug Fixes

1.5.58 (2023-01-13)

Bug Fixes

1.5.57 (2023-01-10)

Bug Fixes

1.5.56 (2023-01-09)

Bug Fixes

1.5.55 (2023-01-06)

Bug Fixes

1.5.54 (2023-01-05)

Bug Fixes

1.5.53 (2023-01-01)

Bug Fixes

1.5.52 (2022-12-31)

Bug Fixes

1.5.51 (2022-12-30)

Bug Fixes

  • update config sources to use template braces with entry on src (022803a)

1.5.50 (2022-12-29)

Bug Fixes

1.5.49 (2022-12-27)

Bug Fixes

1.5.48 (2022-12-25)

Bug Fixes

1.5.47 (2022-12-23)

Bug Fixes

1.5.46 (2022-12-22)

Bug Fixes

1.5.45 (2022-12-22)

Bug Fixes

  • update demos and bump dependencies (2c5ba00)

1.5.44 (2022-12-21)

Bug Fixes

1.5.43 (2022-12-20)

Bug Fixes

1.5.42 (2022-12-15)

Bug Fixes

  • add missing dev dependency style-loader (0515d6b)

1.5.41 (2022-12-13)

Bug Fixes

  • removed un used devDependencies (558bff2)

1.5.40 (2022-12-13)

Bug Fixes

1.5.39 (2022-12-12)

Bug Fixes

1.5.38 (2022-12-11)

Bug Fixes

1.5.37 (2022-12-09)

Bug Fixes

1.5.36 (2022-12-08)

Bug Fixes

1.5.35 (2022-12-07)

Bug Fixes

1.5.34 (2022-12-04)

Bug Fixes

1.5.33 (2022-12-02)

Bug Fixes

1.5.32 (2022-11-28)

Bug Fixes

1.5.31 (2022-11-28)

Bug Fixes

1.5.30 (2022-11-27)

Bug Fixes

1.5.29 (2022-11-26)

Bug Fixes

1.5.28 (2022-11-25)

Bug Fixes

1.5.27 (2022-11-24)

Bug Fixes

1.5.26 (2022-11-23)

Bug Fixes

1.5.25 (2022-11-22)

Bug Fixes

1.5.24 (2022-11-22)

Bug Fixes

  • apply src: {{source}} to CoCreate.config (2c36e17)

1.5.23 (2022-11-21)

Bug Fixes

1.5.22 (2022-11-21)

Bug Fixes

  • replaced document_id with document._id (e77a82c)

1.5.21 (2022-11-21)

Bug Fixes

1.5.20 (2022-11-21)

Bug Fixes

1.5.19 (2022-11-21)

Bug Fixes

  • bump d@cocreate ependencies (264662e)

1.5.18 (2022-10-02)

Bug Fixes

1.5.17 (2022-10-02)

Bug Fixes

1.5.16 (2022-10-02)

Bug Fixes

  • bump @cocreate/hosting and @cocreate/socket-client (3c2fa07)

1.5.15 (2022-10-01)

Bug Fixes

1.5.14 (2022-10-01)

Bug Fixes

1.5.13 (2022-10-01)

Bug Fixes

1.5.12 (2022-10-01)

Bug Fixes

1.5.11 (2022-09-30)

Bug Fixes

1.5.10 (2022-09-30)

Bug Fixes

1.5.9 (2022-09-30)

Bug Fixes

1.5.8 (2022-09-30)

Bug Fixes

1.5.7 (2022-09-30)

Bug Fixes

1.5.6 (2022-09-29)

Bug Fixes

  • config renameed to CoCreateConfig (4c6ad1a)

1.5.5 (2022-09-01)

Bug Fixes

1.5.4 (2022-06-18)

Bug Fixes

1.5.3 (2022-06-12)

Bug Fixes

1.5.2 (2022-05-23)

Bug Fixes

1.5.1 (2022-05-17)

Bug Fixes

  • update document_id on link index.css (f0e5871)

1.5.0 (2022-05-14)

Features

  • function readDocumentList has been renamed to readDocuments (e23accd)

1.4.7 (2022-05-06)

Bug Fixes

  • update config organization_Id to organization_id (5b9fd72)

1.4.6 (2022-02-24)

Bug Fixes

  • CoCreate.config replace CoCreate.app with * (e29b8b8)

1.4.5 (2022-02-16)

Bug Fixes

1.4.4 (2022-02-10)

Bug Fixes

1.4.3 (2022-02-07)

Bug Fixes

  • bump dependency versions (171b684)

1.4.2 (2022-02-03)

Bug Fixes

  • replaced show and hide class hidden with attribute hidden (01e22a5)

1.4.1 (2022-02-01)

Bug Fixes

  • update dependency versions (1fc7d44)

1.4.0 (2022-02-01)

Features

  • observe documentElement instead of body (1c57178)

1.3.56 (2022-01-01)

Bug Fixes

  • get-value attribute value now supports a selector added # to all values currently in get-value attributes (e372644)

1.3.55 (2021-12-15)

Bug Fixes

1.3.54 (2021-12-14)

Bug Fixes

1.3.53 (2021-11-27)

Bug Fixes

1.3.52 (2021-11-27)

Bug Fixes

1.3.51 (2021-11-27)

Bug Fixes

  • update docs api and cocreateJS script (b096989)

1.3.50 (2021-11-26)

Bug Fixes

1.3.49 (2021-11-26)

Bug Fixes

1.3.48 (2021-11-23)

Bug Fixes

1.3.47 (2021-11-20)

Bug Fixes

  • remove cdn.CoCreate.min.css (e309019)

1.3.46 (2021-11-20)

Bug Fixes

1.3.45 (2021-11-19)

Bug Fixes

1.3.44 (2021-11-18)

Bug Fixes

1.3.43 (2021-11-16)

Bug Fixes

1.3.42 (2021-11-15)

Bug Fixes

1.3.41 (2021-11-11)

Bug Fixes

1.3.40 (2021-11-06)

Bug Fixes

1.3.39 (2021-11-04)

Bug Fixes

1.3.38 (2021-11-04)

Bug Fixes

1.3.37 (2021-11-03)

Bug Fixes

1.3.36 (2021-11-01)

Bug Fixes

  • update package dependencies (f97e2a0)

1.3.35 (2021-10-29)

Bug Fixes

1.3.34 (2021-10-17)

Bug Fixes

1.3.33 (2021-10-16)

Bug Fixes

  • update socket package to fix bug in docs (19d0f7d)

1.3.32 (2021-10-15)

Bug Fixes

1.3.31 (2021-10-15)

Bug Fixes

1.3.30 (2021-10-15)

Bug Fixes

1.3.29 (2021-10-13)

Bug Fixes

1.3.28 (2021-10-13)

Bug Fixes

1.3.27 (2021-10-06)

Bug Fixes

1.3.26 (2021-10-05)

Bug Fixes

  • update dependencies (17ac64a)
  • website_id in CoCreate.config (a865cfa)

1.3.25 (2021-10-04)

Bug Fixes

1.3.24 (2021-10-04)

Bug Fixes

1.3.23 (2021-10-01)

Bug Fixes

1.3.22 (2021-10-01)

Bug Fixes

1.3.21 (2021-09-28)

Bug Fixes

1.3.20 (2021-09-16)

Bug Fixes

1.3.19 (2021-09-14)

Bug Fixes

  • add cocreate.app to domains (001fbfd)

1.3.18 (2021-09-13)

Bug Fixes

1.3.17 (2021-09-12)

Bug Fixes

  • update sidenav to use resize and toggle (5b424d7)

1.3.16 (2021-09-09)

Bug Fixes

  • update dependency @cocreate/docs (0f9b773)

1.3.15 (2021-09-09)

Bug Fixes

1.3.14 (2021-09-09)

Bug Fixes

1.3.13 (2021-09-09)

Bug Fixes

  • CoCreate.config directory, path, name and public (49ff119)

1.3.12 (2021-09-08)

Bug Fixes

1.3.11 (2021-09-04)

Bug Fixes

1.3.10 (2021-08-31)

Bug Fixes

1.3.9 (2021-08-31)

Bug Fixes

1.3.8 (2021-08-27)

Bug Fixes

1.3.7 (2021-08-23)

Bug Fixes

  • update package versions (ae174eb)

1.3.6 (2021-08-22)

Bug Fixes

  • removed data- from main-content, clone, filter-value_type (eb29496)

1.3.5 (2021-08-22)

Bug Fixes

1.3.4 (2021-08-22)

Bug Fixes

1.3.3 (2021-08-14)

Bug Fixes

1.3.2 (2021-08-02)

Bug Fixes

  • remove data- from attributes (4a13704)
  • update data-fullscreen to fullscreen (fe78f5c)

1.3.1 (2021-07-28)

Bug Fixes

  • remove data- from fetch, pass and filter (c5e8b03)

1.3.0 (2021-07-28)

Features

  • add new is{attribute} system and remove data- from attributtes (8c187f0)

1.2.15 (2021-07-27)

Bug Fixes

  • revert back to working commit (1598a63)

1.2.14 (2021-07-24)

Bug Fixes

1.2.13 (2021-07-17)

Bug Fixes

1.2.12 (2021-07-14)

Bug Fixes

1.2.11 (2021-07-13)

Bug Fixes

  • add yarn lockfile to git ignore (326ba42)
  • remove yarn.lock (6ceb892)

1.2.10 (2021-07-10)

Bug Fixes

1.2.9 (2021-07-08)

Bug Fixes

  • revert master back to old observer (2e61aea)

1.2.8 (2021-06-30)

Bug Fixes

1.2.7 (2021-06-30)

Bug Fixes

  • automated and manual workflows (60ed086)

1.2.6 (2021-06-29)

Bug Fixes

1.2.5 (2021-06-25)

Bug Fixes

  • latest version numbers applied to all cocreate packages (4e46466)

1.2.4 (2021-06-24)

Bug Fixes

  • package versioningto 1.0.0 (3649405)

1.2.3 (2021-06-24)

Bug Fixes

  • add method to turn on and off console.log while in development (0b4632e)
  • update all @cocreate to use latest versions (f502a11)

1.2.2 (2021-06-23)

Bug Fixes

  • update to new crud.save and crud.read (d641653)

1.2.1 (2021-06-20)

Bug Fixes

  • new mutaionObserver init function (3824a30)

1.2.0 (2021-06-19)

Features

  • support for remNodes and addedNodes (abddcaa)

1.1.1 (2021-06-06)

Bug Fixes

  • synatax error in package.json (2150907)
  • Update docs and package.json descriptions (0243e46)

1.1.0 (2021-05-24)

Features

  • observe when element removed (8d023df)

1.0.5 (2021-04-27)

Bug Fixes

1.0.4 (2021-04-27)

Bug Fixes

  • Update to readme, demo, added cdn scripts (a69bb72)

1.0.3 (2021-04-23)

Bug Fixes

  • readme and documentation. Removed securitykeys (1a7ae6c)

1.0.2 (2021-04-19)

Bug Fixes

  • ci and build process (ac464c3)
  • npm publish and cdn deployment (6aaad04)

1.0.1 (2021-03-29)

Bug Fixes

1.0.0 (2021-03-26)

Features