@egjs/imready
Advanced tools
Comparing version 0.1.0 to 1.0.0
@@ -7,3 +7,3 @@ /* | ||
repository: https://github.com/naver/egjs-imready | ||
version: 0.1.0 | ||
version: 1.0.0 | ||
*/ | ||
@@ -10,0 +10,0 @@ 'use strict'; |
@@ -7,3 +7,3 @@ /* | ||
repository: https://github.com/naver/egjs-imready | ||
version: 0.1.0 | ||
version: 1.0.0 | ||
*/ | ||
@@ -10,0 +10,0 @@ import Component from '@egjs/component'; |
@@ -7,3 +7,3 @@ /* | ||
repository: https://github.com/naver/egjs-imready | ||
version: 0.1.0 | ||
version: 1.0.0 | ||
*/ | ||
@@ -10,0 +10,0 @@ (function (global, factory) { |
@@ -7,5 +7,5 @@ /* | ||
repository: https://github.com/naver/egjs-imready | ||
version: 0.1.0 | ||
version: 1.0.0 | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):((t=t||self).eg=t.eg||{},t.eg.ImReady=e())}(this,function(){"use strict";var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function o(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var i=function(){return(i=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function d(t){return void 0===t}var t=function(){function t(){this.options={},this._eventHandler={}}var e=t.prototype;return e.trigger=function(t){for(var e=this,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];if(!(0<(a=this._eventHandler[t]||[]).length))return!0;var o=n[0]||{},i=n.slice(1),a=a.concat(),s=!1;o.eventType=t,o.stop=function(){s=!0},o.currentTarget=this;var u=[o];return 1<=i.length&&(u=u.concat(i)),a.forEach(function(t){t.apply(e,u)}),!s},e.once=function(n,r){var o,i=this;if("object"==typeof n&&d(r)){var t,e=n;for(t in e)this.once(t,e[t]);return this}return"string"==typeof n&&"function"==typeof r&&(o=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];r.apply(i,t),i.off(n,o)},this.on(n,o)),this},e.hasOn=function(t){return!!this._eventHandler[t]},e.on=function(t,e){if("object"==typeof t&&d(e)){var n,r=t;for(n in r)this.on(n,r[n]);return this}var o;return"string"==typeof t&&"function"==typeof e&&(d(o=this._eventHandler[t])&&(this._eventHandler[t]=[],o=this._eventHandler[t]),o.push(e)),this},e.off=function(t,e){var n,r;if(d(t))return this._eventHandler={},this;if(d(e)){if("string"==typeof t)return delete this._eventHandler[t],this;var o,i=t;for(o in i)this.off(o,i[o]);return this}var a=this._eventHandler[t];if(a){var s=0;try{for(var u=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(a),h=u.next();!h.done;h=u.next()){if(h.value===e){a.splice(s,1);break}s++}}catch(t){n={error:t}}finally{try{h&&!h.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}}return this},t.VERSION="2.2.2",t}(),e="undefined"!=typeof window,n=e?window.navigator.userAgent:"",a=e&&!!("getComputedStyle"in window),s=/MSIE|Trident|Windows Phone|Edge/.test(n),u=e&&!!("addEventListener"in document),h="width",l="height";function f(t,e){return t.getAttribute(e)||""}function c(t){return[].slice.call(t)}function y(t,e,n){u?t.addEventListener(e,n,!1):t.attachEvent?t.attachEvent("on"+e,n):t["on"+e]=n}function p(t,e,n){t.removeEventListener?t.removeEventListener(e,n,!1):t.detachEvent?t.detachEvent("on"+e,n):t["on"+e]=null}function v(t,e){var n=t["client"+e]||t["offset"+e];return parseFloat(n||(t=t,((a?window.getComputedStyle(t):t.currentStyle)||{})[e.toLowerCase()]))||0}function g(t,e,n){var r=c(t.querySelectorAll(function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;for(var r=Array(t),o=0,e=0;e<n;e++)for(var i=arguments[e],a=0,s=i.length;a<s;a++,o++)r[o]=i[a];return r}(["["+n+"skip] ["+n+"width]"],e.map(function(t){return["["+n+"skip] "+t,t+"["+n+"skip]","["+n+"width] "+t].join(", ")})).join(", ")));return c(t.querySelectorAll("["+n+"width], "+e.join(", "))).filter(function(t){return-1===r.indexOf(t)})}var R=[];function m(t,e){void 0===e&&(e="data-");var n,r=t.__PREFIX__||e,o=parseInt(f(t,""+r+h),10)||0,e=parseInt(f(t,""+r+l),10)||0;f(t,r+"fixed")===l?(n=v(t,"Height")||e,t.style[h]=o/e*n+"px"):(n=v(t,"Width")||o,t.style[l]=e/o*n+"px")}function E(){R.forEach(function(t){m(t)})}var C,e=function(r){function t(t,e){void 0===e&&(e={});var n=r.call(this)||this;return n.isReady=!1,n.hasDataSize=!1,n.hasLoading=!1,n.onCheck=function(t){n.destroy(),t&&"error"===t.type&&n.onError(n.element);t=!n.hasDataSize&&!n.hasLoading;n.onReady(t)},n.options=i({prefix:"data-"},e),n.element=t,n.hasDataSize=(e=n.element,void 0===(t=n.options.prefix)&&(t="data-"),!!e.getAttribute(t+"width")),n.hasLoading="loading"in(t=n.element)&&"lazy"===t.getAttribute("loading"),n}o(t,r);var e=t.prototype;return e.check=function(){return this.checkElement()?(this.hasDataSize&&(t=this.element,e=this.options.prefix,R.length||y(window,"resize",E),t.__PREFIX__=e,R.push(t),m(t)),(this.hasDataSize||this.hasLoading||this.isPreReady())&&this.onAlreadyPreReady(),!0):(this.onAlreadyReady(!0),!1);var t,e},e.isPreReady=function(){return!1},e.addEvents=function(){var e=this,n=this.element;this.constructor.EVENTS.forEach(function(t){y(n,t,e.onCheck)})},e.destroy=function(){var e=this,n=this.element;this.constructor.EVENTS.forEach(function(t){p(n,t,e.onCheck)}),this.removeAutoSizer()},e.removeAutoSizer=function(){var t,e,n;this.hasDataSize&&(n=this.options.prefix,t=this.element,e=n,(n=R.indexOf(t))<0||(e=f(t,e+"fixed"),delete t.__PREFIX__,t.style[e===l?h:l]="",R.splice(n,1),R.length||p(window,"resize",E)))},e.onError=function(t){this.trigger("error",{element:this.element,target:t})},e.onPreReady=function(){this.trigger("preReady",{element:this.element,hasLoading:this.hasLoading})},e.onReady=function(t){this.removeAutoSizer(),this.isReady=!0,this.trigger("ready",{element:this.element,withPreReady:t,hasLoading:this.hasLoading})},e.onAlreadyError=function(t){var e=this;setTimeout(function(){e.onError(t)})},e.onAlreadyPreReady=function(){var t=this;setTimeout(function(){t.onPreReady()})},e.onAlreadyReady=function(t){var e=this;setTimeout(function(){e.onReady(t)})},t.EVENTS=[],t}(t),P=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}o(e,t);var n=e.prototype;return n.checkElement=function(){return this.hasDataSize||this.trigger("requestChildren"),!0},n.destroy=function(){this.removeAutoSizer(),this.trigger("requestDestroy")},n.onAlreadyPreReady=function(){t.prototype.onAlreadyPreReady.call(this),this.trigger("reqeustReadyChildren")},e.EVENTS=[],e}(e),t=function(n){function t(t){void 0===t&&(t={});var e=n.call(this)||this;return e.readyCount=0,e.preReadyCount=0,e.totalCount=0,e.totalErrorCount=0,e.isPreReadyOver=!0,e.elementInfos=[],e.options=i({loaders:{},prefix:"data-"},t),e}o(t,n);var e=t.prototype;return e.check=function(t){var o=this,n=this.options.prefix;this.clear(),this.elementInfos=c(t).filter(function(t){return void 0===(e=n)&&(e="data-"),!t.getAttribute(e+"skip");var e}).map(function(t,r){var e=o.getLoader(t,{prefix:n});return e.check(),e.on("error",function(t){o.onError(r,t.target)}).on("preReady",function(t){o.elementInfos[r].hasLoading=t.hasLoading;t=o.checkPreReady(r);o.onPreReadyElement(r),t&&o.onPreReady()}).on("ready",function(t){var e=t.withPreReady,n=t.hasLoading;o.elementInfos[r].hasLoading=n;t=e&&o.checkPreReady(r),n=o.checkReady(r);e&&o.onPreReadyElement(r),o.onReadyElement(r),t&&o.onPreReady(),n&&o.onReady()}),{loader:e,element:t,hasLoading:!1,hasError:!1,isPreReady:!1,isReady:!1}});t=this.elementInfos.length;return(this.totalCount=t)||setTimeout(function(){o.onPreReady(),o.onReady()}),this},e.getTotalCount=function(){return this.totalCount},e.isPreReady=function(){return this.elementInfos.every(function(t){return t.isPreReady})},e.isReady=function(){return this.elementInfos.every(function(t){return t.isReady})},e.clear=function(){this.isPreReadyOver=!1,this.totalCount=0,this.preReadyCount=0,this.readyCount=0,this.totalErrorCount=0,this.elementInfos.forEach(function(t){!t.isReady&&t.loader&&t.loader.destroy()}),this.elementInfos=[]},e.destroy=function(){this.clear(),this.off()},e.getLoader=function(e,t){var n=this,r=e.tagName.toLowerCase(),o=this.options.loaders,i=Object.keys(o);if(o[r])return new o[r](e,t);var a=new P(e,t),s=!1,u=this.clone().on("error",function(t){a.onError(t.target)}).on("ready",function(){a.onReady(s)});return a.on("requestChildren",function(){var t=g(e,i,n.options.prefix);u.check(t).on("preReady",function(t){(s=t.isReady)||a.onPreReady()})}).on("reqeustReadyChildren",function(){var t=c(e.querySelectorAll(i.join(", ")));u.check(t)}).on("requestDestroy",function(){u.destroy()}),a},e.clone=function(){return new t(i({},this.options))},e.checkPreReady=function(t){return this.elementInfos[t].isPreReady=!0,++this.preReadyCount,!(this.preReadyCount<this.totalCount)},e.checkReady=function(t){return this.elementInfos[t].isReady=!0,++this.readyCount,!(this.readyCount<this.totalCount)},e.onError=function(t,e){var n=this.elementInfos[t];n.hasError=!0,this.trigger("error",{element:n.element,index:t,target:e,errorCount:this.getErrorCount(),totalErrorCount:++this.totalErrorCount})},e.onPreReadyElement=function(t){var e=this.elementInfos[t];this.trigger("preReadyElement",{element:e.element,index:t,preReadyCount:this.preReadyCount,readyCount:this.readyCount,totalCount:this.totalCount,isPreReady:this.isPreReady(),isReady:this.isReady(),hasLoading:e.hasLoading})},e.onPreReady=function(){this.isPreReadyOver=!0,this.trigger("preReady",{readyCount:this.readyCount,totalCount:this.totalCount,isReady:this.isReady(),hasLoading:this.hasLoading()})},e.onReadyElement=function(t){var e=this.elementInfos[t];this.trigger("readyElement",{index:t,element:e.element,hasError:e.hasError,errorCount:this.getErrorCount(),totalErrorCount:this.totalErrorCount,preReadyCount:this.preReadyCount,readyCount:this.readyCount,totalCount:this.totalCount,isPreReady:this.isPreReady(),isReady:this.isReady(),hasLoading:e.hasLoading,isPreReadyOver:this.isPreReadyOver})},e.onReady=function(){this.trigger("ready",{errorCount:this.getErrorCount(),totalErrorCount:this.totalErrorCount,totalCount:this.totalCount})},e.getErrorCount=function(){return this.elementInfos.filter(function(t){return t.hasError}).length},e.hasLoading=function(){return this.elementInfos.some(function(t){return t.hasLoading})},t}(t),_=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}o(e,t);var n=e.prototype;return n.isPreReady=function(){var t=this.element;return t.complete&&(!s||s&&!!t.naturalWidth)},n.checkElement=function(){var t=this.element;return this.isPreReady()?(t.naturalWidth||this.onAlreadyError(this.element),!1):(this.addEvents(),s&&t.setAttribute("src",t.getAttribute("src")),!0)},e.EVENTS=["load","error"],e}(e),L=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.checkElement=function(){var t=this.element;return!(1<=t.readyState)&&(t.error?(this.onAlreadyError(t),!1):(this.addEvents(),!0))},e.EVENTS=["loadedmetadata","error"],e}(e),w=function(e){function t(t){return void 0===t&&(t={}),e.call(this,i({loaders:{img:_,video:L}},t))||this}return o(t,e),t}(t),S={__proto__:null,default:w,Manager:t,VideoLoader:L,ImageLoader:_,Loader:e};for(C in S)w[C]=S[C];return w}); | ||
//# sourceMappingURL=imready.min.js.map |
154
package.json
{ | ||
"name": "@egjs/imready", | ||
"version": "0.1.0", | ||
"description": "This module is used to wait for the image or video to be ready.", | ||
"main": "dist/imready.js", | ||
"module": "dist/imready.esm.js", | ||
"types": "declaration/index.d.ts", | ||
"sideEffects": false, | ||
"scripts": { | ||
"start": "rollup -c -w", | ||
"jsdoc": "rm -rf ./doc && jsdoc -c jsdoc.json", | ||
"test": "karma start", | ||
"lint": "eslint ./src/ --ext .ts", | ||
"build": "rm -rf ./dist ./declaration && rollup -c && npm run declaration && npm run printsizes", | ||
"test:chrome": "karma start --chrome", | ||
"coverage": "karma start --coverage && print-coveralls --sort=desc", | ||
"printsizes": "print-sizes ./dist --exclude=\\.map", | ||
"declaration": "rm -rf declaration && tsc -p tsconfig.declaration.json", | ||
"demo:build": "npm run build && cpx 'dist/**/*' demo/release/latest/dist --clean", | ||
"demo:prebuild-version": "cpx 'dist/**/*' demo/release/$npm_package_version/dist --clean && cpx 'doc/**/*' demo/release/$npm_package_version/doc --clean", | ||
"demo:prebuild-latest": "cpx 'dist/**/*' demo/release/latest/dist --clean && cpx 'doc/**/*' demo/release/latest/doc --clean", | ||
"demo:deploy": "npm run build && npm run jsdoc && npm run demo:prebuild-version && npm run demo:prebuild-latest && gh-pages -d demo/ --add --remote oss", | ||
"release": "release-helper upstream" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/naver/egjs-imready" | ||
}, | ||
"author": { | ||
"name": "NAVER Corp." | ||
}, | ||
"namespace": { | ||
"eg": "eg" | ||
}, | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@daybrush/jsdoc": "^0.3.8", | ||
"@egjs/build-helper": "^0.1.2", | ||
"@egjs/release-helper": "0.0.3", | ||
"@types/chai": "^4.1.7", | ||
"@types/karma-chai": "^0.1.1", | ||
"@types/mocha": "^5.2.6", | ||
"@types/sinon": "^7.0.10", | ||
"@typescript-eslint/eslint-plugin": "^3.9.1", | ||
"@typescript-eslint/parser": "^3.9.1", | ||
"chai": "^4.2.0", | ||
"cpx": "^1.5.0", | ||
"egjs-jsdoc-template": "^1.4.4", | ||
"eslint": "^7.7.0", | ||
"gh-pages": "^2.0.1", | ||
"husky": "^1.3.1", | ||
"karma": "^4.0.1", | ||
"karma-chai": "^0.1.0", | ||
"karma-chrome-launcher": "^2.2.0", | ||
"karma-mocha": "^1.3.0", | ||
"karma-mocha-reporter": "^2.2.5", | ||
"karma-typescript": "^4.0.0", | ||
"karma-viewport": "^1.0.4", | ||
"mocha": "^6.0.2", | ||
"print-coveralls": "^1.2.2", | ||
"print-sizes": "^0.1.0", | ||
"rollup": "^1.7.3", | ||
"rollup-plugin-node-resolve": "^4.0.1", | ||
"rollup-plugin-prototype-minify": "^1.0.5", | ||
"rollup-plugin-replace": "^2.1.1", | ||
"rollup-plugin-typescript": "^1.0.1", | ||
"rollup-plugin-uglify": "^6.0.2", | ||
"sinon": "^7.3.0", | ||
"tslib": "^2.0.3", | ||
"typescript": "^3.9.7" | ||
}, | ||
"dependencies": { | ||
"@egjs/component": "^2.2.2" | ||
} | ||
"name": "@egjs/imready", | ||
"version": "1.0.0", | ||
"description": "This module is used to wait for the image or video to be ready.", | ||
"main": "dist/imready.js", | ||
"module": "dist/imready.esm.js", | ||
"types": "declaration/index.d.ts", | ||
"sideEffects": false, | ||
"scripts": { | ||
"start": "rollup -c -w", | ||
"jsdoc": "rm -rf ./doc && jsdoc -c jsdoc.json", | ||
"test": "karma start", | ||
"lint": "eslint ./src/ --ext .ts", | ||
"build": "rm -rf ./dist ./declaration && rollup -c && npm run declaration && npm run printsizes", | ||
"test:chrome": "karma start --chrome", | ||
"coverage": "karma start --coverage && print-coveralls --sort=desc", | ||
"printsizes": "print-sizes ./dist --exclude=\\.map", | ||
"declaration": "rm -rf declaration && tsc -p tsconfig.declaration.json", | ||
"demo:build": "npm run build && cpx 'dist/**/*' demo/release/latest/dist --clean", | ||
"demo:prebuild-version": "cpx 'dist/**/*' demo/release/$npm_package_version/dist --clean && cpx 'doc/**/*' demo/release/$npm_package_version/doc --clean", | ||
"demo:prebuild-latest": "cpx 'dist/**/*' demo/release/latest/dist --clean && cpx 'doc/**/*' demo/release/latest/doc --clean", | ||
"demo:deploy": "npm run build && npm run jsdoc && npm run demo:prebuild-version && npm run demo:prebuild-latest && gh-pages -d demo/ --remote upstream", | ||
"release": "release-helper upstream" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/naver/egjs-imready" | ||
}, | ||
"author": { | ||
"name": "NAVER Corp." | ||
}, | ||
"namespace": { | ||
"eg": "eg" | ||
}, | ||
"keywords": [ | ||
"lazyloading", | ||
"ready", | ||
"imready", | ||
"image", | ||
"video", | ||
"egjs" | ||
], | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@daybrush/jsdoc": "^0.3.8", | ||
"@egjs/build-helper": "^0.1.2", | ||
"@egjs/release-helper": "0.0.3", | ||
"@types/chai": "^4.1.7", | ||
"@types/karma-chai": "^0.1.1", | ||
"@types/mocha": "^5.2.6", | ||
"@types/sinon": "^7.0.10", | ||
"@typescript-eslint/eslint-plugin": "^3.9.1", | ||
"@typescript-eslint/parser": "^3.9.1", | ||
"chai": "^4.2.0", | ||
"cpx": "^1.5.0", | ||
"egjs-jsdoc-template": "^1.4.4", | ||
"eslint": "^7.7.0", | ||
"gh-pages": "^2.0.1", | ||
"husky": "^1.3.1", | ||
"karma": "^4.0.1", | ||
"karma-chai": "^0.1.0", | ||
"karma-chrome-launcher": "^2.2.0", | ||
"karma-mocha": "^1.3.0", | ||
"karma-mocha-reporter": "^2.2.5", | ||
"karma-typescript": "^4.0.0", | ||
"karma-viewport": "^1.0.4", | ||
"mocha": "^6.0.2", | ||
"print-coveralls": "^1.2.2", | ||
"print-sizes": "^0.1.0", | ||
"rollup": "^1.7.3", | ||
"rollup-plugin-node-resolve": "^4.0.1", | ||
"rollup-plugin-prototype-minify": "^1.0.5", | ||
"rollup-plugin-replace": "^2.1.1", | ||
"rollup-plugin-typescript": "^1.0.1", | ||
"rollup-plugin-uglify": "^6.0.2", | ||
"sinon": "^7.3.0", | ||
"tslib": "^2.0.3", | ||
"typescript": "^3.9.7" | ||
}, | ||
"dependencies": { | ||
"@egjs/component": "^2.2.2" | ||
} | ||
} |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
351210