@cocreate/observer
Advanced tools
Comparing version 1.2.8 to 1.2.9
@@ -0,1 +1,8 @@ | ||
## [1.2.9](https://github.com/CoCreate-app/CoCreate-observer/compare/v1.2.8...v1.2.9) (2021-07-08) | ||
### Bug Fixes | ||
* revert master back to old observer ([2e61aea](https://github.com/CoCreate-app/CoCreate-observer/commit/2e61aea51285862c7c44a0590157f789a8b546df)) | ||
## [1.2.8](https://github.com/CoCreate-app/CoCreate-observer/compare/v1.2.7...v1.2.8) (2021-06-30) | ||
@@ -2,0 +9,0 @@ |
@@ -1,12 +0,106 @@ | ||
const observer = new MutationObserver((list)=>{ | ||
console.log(list) | ||
}); | ||
import observer from "../src/index"; | ||
observer.observe(document.body, { | ||
subtree: true, // observers all children and children of children | ||
childList: true, // observes when elements are added and removed | ||
attributes: true, // observers all children and children of children | ||
attributeOldValue: true, | ||
characterData: true, // observes inntext change | ||
characterDataOldValue: true | ||
}); | ||
// observer.init({ | ||
// name: 'Test Attribute', | ||
// observe: ['attributes'], | ||
// // attributeFilter:['ba'], | ||
// callback: function(mutation) { | ||
// console.log('anhy attribute observed', mutation) | ||
// }, | ||
// }) | ||
// observer.init({ | ||
// name: 'Test Attribute', | ||
// observe: ['attributes'], | ||
// attributeFilter: ['ba'], | ||
// callback: function(mutation) { | ||
// console.log('ba observed', mutation) | ||
// }, | ||
// }) | ||
// observer.init({ | ||
// name: 'Test Attribute', | ||
// observe: ['attributes'], | ||
// target: 'div.el', | ||
// callback: function(mutation) { | ||
// console.log('div.el observed', mutation) | ||
// }, | ||
// }) | ||
// observer.init({ | ||
// name: 'Test Attribute', | ||
// observe: ['attributes'], | ||
// attributeFilter: ['ba'], | ||
// target: 'div.el', | ||
// callback: function(mutation) { | ||
// console.log('div.el with attribute ba observed', mutation) | ||
// }, | ||
// }) | ||
// observer.init({ | ||
// name: 'Test Attribute', | ||
// observe: ['characterData'], | ||
// callback: function(mutation) { | ||
// console.log('characterData observed', mutation) | ||
// }, | ||
// }) | ||
// observer.init({ | ||
// name: 'Test Attribute', | ||
// observe: ['characterData'], | ||
// target: 'div.el', | ||
// callback: function(mutation) { | ||
// console.log('characterDat with div.el observed', mutation) | ||
// }, | ||
// }) | ||
// observer.init({ | ||
// name: "Test Attribute", | ||
// observe: ["childList"], | ||
// callback: function (mutation) { | ||
// console.log("childList observed", mutation); | ||
// }, | ||
// }); | ||
// observer.init({ | ||
// name: "Test Attribute", | ||
// observe: ["childList"], | ||
// target: "div.el", | ||
// callback: function (mutation) { | ||
// console.log("childList div.el observed", mutation); | ||
// }, | ||
// }); | ||
observer.init({ | ||
name: "Test Attribute", | ||
observe: ["addedNodes"], | ||
callback: function (mutation) { | ||
console.log("addedNodes observed", mutation); | ||
}, | ||
}); | ||
observer.init({ | ||
name: "Test Attribute", | ||
observe: ["addedNodes"], | ||
target: "div.el", | ||
callback: function (mutation) { | ||
console.log("addedNodes div.el observed", mutation); | ||
}, | ||
}); | ||
observer.init({ | ||
name: "Test Attribute", | ||
observe: ["removedNodes"], | ||
callback: function (mutation) { | ||
console.log("removedNodes observed", mutation); | ||
}, | ||
}); | ||
observer.init({ | ||
name: "Test Attribute", | ||
observe: ["removedNodes"], | ||
target: "div.el", | ||
callback: function (mutation) { | ||
console.log("removedNodes div.el observed", mutation); | ||
}, | ||
}); |
{ | ||
"name": "@cocreate/observer", | ||
"version": "1.2.8", | ||
"version": "1.2.9", | ||
"description": "Register a components init function & observe selector. The init function will be fired immedietly after detection of selector.", | ||
@@ -64,5 +64,5 @@ "keywords": [ | ||
"dependencies": { | ||
"@cocreate/docs": "^1.1.14", | ||
"@cocreate/utils": "^1.0.14" | ||
"@cocreate/docs": "^1.1.29", | ||
"@cocreate/utils": "^1.0.16" | ||
} | ||
} |
@@ -8,79 +8,78 @@ const path = require("path") | ||
module.exports = { | ||
entry: { | ||
"CoCreate-observer": "./src/index.js", | ||
}, | ||
output: { | ||
path: path.resolve(__dirname, "dist"), | ||
filename: isProduction ? "[name].min.js" : "[name].js", | ||
libraryTarget: "umd", | ||
libraryExport: "default", | ||
library: ["CoCreate", "observer"], | ||
globalObject: "this", | ||
// publicPath: 'https://server.cocreate.app/CoCreateJS/dist/' | ||
}, | ||
entry: { | ||
"CoCreate-observer": "./demo/test.1.js", | ||
}, | ||
output: { | ||
path: path.resolve(__dirname, "dist"), | ||
filename: isProduction ? "[name].min.js" : "[name].js", | ||
libraryTarget: "umd", | ||
libraryExport: "default", | ||
library: ["CoCreate", "observer"], | ||
globalObject: "this", | ||
// publicPath: 'https://server.cocreate.app/CoCreateJS/dist/' | ||
}, | ||
plugins: [ | ||
new CleanWebpackPlugin(), | ||
new MiniCssExtractPlugin({ | ||
filename: "[name].css", | ||
}), | ||
], | ||
// Default mode for Webpack is production. | ||
// Depending on mode Webpack will apply different things | ||
// on final bundle. For now we don't need production's JavaScript | ||
// minifying and other thing so let's set mode to development | ||
mode: isProduction ? "production" : "development", | ||
module: { | ||
rules: [ | ||
{ | ||
test: /.js$/, | ||
exclude: /(node_modules)/, | ||
use: { | ||
loader: "babel-loader", | ||
options: { | ||
plugins: ["@babel/plugin-transform-modules-commonjs"], | ||
}, | ||
}, | ||
}, | ||
{ | ||
test: /.css$/i, | ||
use: [ | ||
{ loader: "style-loader", options: { injectType: "linkTag" } }, | ||
"file-loader", | ||
plugins: [ | ||
new CleanWebpackPlugin(), | ||
new MiniCssExtractPlugin({ | ||
filename: "[name].css", | ||
}), | ||
], | ||
// Default mode for Webpack is production. | ||
// Depending on mode Webpack will apply different things | ||
// on final bundle. For now we don't need production's JavaScript | ||
// minifying and other thing so let's set mode to development | ||
mode: isProduction ? "production" : "development", | ||
module: { | ||
rules: [{ | ||
test: /.js$/, | ||
exclude: /(node_modules)/, | ||
use: { | ||
loader: "babel-loader", | ||
options: { | ||
plugins: ["@babel/plugin-transform-modules-commonjs"], | ||
}, | ||
}, | ||
}, | ||
{ | ||
test: /.css$/i, | ||
use: [ | ||
{ loader: "style-loader", options: { injectType: "linkTag" } }, | ||
"file-loader", | ||
], | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
}, | ||
// add source map | ||
...(isProduction ? {} : { devtool: "eval-source-map" }), | ||
// add source map | ||
...(isProduction ? {} : { devtool: "eval-source-map" }), | ||
optimization: { | ||
minimize: true, | ||
minimizer: [ | ||
new TerserPlugin({ | ||
extractComments: true, | ||
// cache: true, | ||
parallel: true, | ||
// sourceMap: true, // Must be set to true if using source-maps in production | ||
terserOptions: { | ||
// https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions | ||
// extractComments: 'all', | ||
compress: { | ||
drop_console: true, | ||
}, | ||
optimization: { | ||
minimize: true, | ||
minimizer: [ | ||
new TerserPlugin({ | ||
extractComments: true, | ||
// cache: true, | ||
parallel: true, | ||
// sourceMap: true, // Must be set to true if using source-maps in production | ||
terserOptions: { | ||
// https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions | ||
// extractComments: 'all', | ||
compress: { | ||
drop_console: true, | ||
}, | ||
}, | ||
}), | ||
], | ||
splitChunks: { | ||
chunks: "all", | ||
minSize: 200, | ||
// maxSize: 99999, | ||
//minChunks: 1, | ||
cacheGroups: { | ||
defaultVendors: false, | ||
}, | ||
}, | ||
}), | ||
], | ||
splitChunks: { | ||
chunks: "all", | ||
minSize: 200, | ||
// maxSize: 99999, | ||
//minChunks: 1, | ||
cacheGroups: { | ||
defaultVendors: false, | ||
}, | ||
}, | ||
}, | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
62293
19
792
Updated@cocreate/docs@^1.1.29
Updated@cocreate/utils@^1.0.16