')); Peoplestore.put ({name:"John",//name is the keyAge:23, Favoriteanimal:' Cat ' }); Peoplestore.put ({name:"Joe",//name is the keyAge:21, Favoriteanimal:' Cat ' }); Peoplestore.put ({name:"Jie",//name is the keyAge:22, Favoriteanimal:' Dog ' }); Peoplestore.put ({name:"Jay",//name is the keyAge:24, Favoriteanimal:' Dog ' }); returnTx.complete;}). Then (function() {Console.log ("People is added");}); Dbpromise.then (function(db) {vartx = Db.transaction (' People ', ' ReadWrite ');
(' Updatefound ',function(){ //reg.installing is changed })})Api:linkFor the service worker itself:var sw =// ... logs "Installing"/ /// "Installed" // "activating"/ /" avvtivated"// "redundant" Sw.addeventlistener (function() { // Sw.state has changed })Aslo about:Naviagetor.serviceWorker.controller"Navigator.serviceWorker.controller" refer to the service worker, that controls the page.So if there was no controller, then it means the data was loading from network:if (! Naviga
the root scope, so it's available to all the Child components.2. Our service worker file:// Sw.js Self.addeventlistener ('fetch', function (event) { Console.log (event. request);});Once you fetch the page seond time (first time service work do cache stuff), second time you'll see in the console, the Re is lots of requests log out.
Of course, service worker has other event listeners:Self.addeventlistener ('Install', Function (Event) { // ..}); Self.addeventlistener ('Activate', Function
Link to CodelabIn this codelab, we'll retrace those steps but this time we'll use a tool called Sw-precache to add offline functionality With only six lines of code. It's never been easier to add service worker support to an existing app, and we'll show you what in this codelab.Learning:
What's the Sw-precache tool is and how it can help you being more productive
How to add a basic service worker to an existing project using Sw-precache
Install:git clone https://gith
) {returnResponse | |fetch (event.request); }) );});The Servephoto ():We want to make sure-things:
We don ' t care the photo size, 800px,200px or 40px
Because respond object can be is only access once, so we need Clone () the original one and use clone one for the CAHCE, retur n the original one to the browser.
functionServephoto (Request) {varStorageurl = Request.url.replace (/-\d+px\.jpg$/, "); returnCaches.open (Contentimgscache). Then (function(cache) {returnCache.match (S
the create the cache, but it was not a useful until we use the cache.To use the cache, we can do:Self.addeventlistener (' Install ',function(event) {varUrlstocache = [ ‘/‘, ' Js/main.js ', ' Css/main.css ', ' Imgs/icon.png ', ' Https://fonts.gstatic.com/s/roboto/v15/2UX7WLTfW3W8TclTUvlFyQ.woff ', ' Https://fonts.gstatic.com/s/roboto/v15/d-6IYplOFocCacKzxwXSOD8E0i7KZn-EPnyo3HZu7kw.woff ' ]; Event.waituntil (//Todo:open A cache named ' Wittr-static-v1 ' //ADD cache The URLs
Label:Use the library indexeddb-promised. Create a database and Stroe: Import IDB from ' IDB ';
// Open (db_name, version, CB)
var function (upgradedb) {
var// CREATE TABLE
//put (value, key )
keyvalstore.put (' World ', ' Hello ')
; Notice put () function take value frist then key. Read the key in Stroe: // read "Hello" in "Keyval"
Dbpromise.then (function (db) {
var// Open a transaction
var// read the store
return// Get value by key
}). Then (function (val)
When we save items to indexdb, we need to think about clean the items or keep those in a short list.Indexcontroller.prototype._onsocketmessage =function (data) {varMessages =json.parse (data); This. _dbpromise.then (function (db) {if(!DB)return; vartx = Db.transaction ('Wittrs','ReadWrite'); varstore = Tx.objectstore ('Wittrs'); Messages.foreach (function (message) {store.put (message); }); //Todo:keep The newest, entries in ' Wittrs ',//But delete the rest. // //hint:you can use. open
modules-> Modulecontroller-> Controllermodel-> ModelMagento is the most powerful shopping cart online platform on the planet. Of course, you should have no doubt about it. However, you may not yet know that Magento is also an object-oriented PHP framework. You can develop dynamic Web applications with the powerful features of the Magento Shopping cart program.This is the beginning of the
Tags:
Plug-ins
Magento
Magento plugin
Required plug-ins
Magento plugin, Plug-ins. I want to use the magento essential plug-ins ..
They are all free magento plug-ins, many of which are complicated ~~
[Powerful for collection> _
If you have a good plug-in, leave a message.
Magento install wordpress and magentowordpress
It is actually very simple to say. Now let's briefly discuss the installation process.
1. Install magento extension on the magento connect interface, address: http://www.magentocommerce.com/magento-connect/magento-wordpress-int
I installed magento2 on ubuntu14. when I access localhost on the webpage, the apache prompt ItWork is displayed !, However, when localhostmagento2 prompts HTTPERROR500, I installed it with the following command: {code ...} after the error, I checked the php error... I installed magento2 on ubuntu14, and accessed http: // localhost/on the webpage to display the apache prompt It Work !, However, http: // localhost/magento2/prompts http error 500
I installed it with the following command:
apt-get
I installed Magento2 on UBUNTU14, Web Access http://localhost/can show the Apache hint it work! , but http://localhost/magento2/tip http ERROR 500
I installed it by using the following command:
Apt-get updateapt-get install git wgetwget-o/usr/local/bin/composer http://getcomposer.org/composer.pharchmod +x/usr /local/bin/composercd/var/wwwgit Clone Https://github.com/magento/magento2.gitcd/var/www/magento2composer Install
After the error, I checked th
Tags: style http ar io os using SP strong onMagento The Ultimate solution for database backup and migration +3Category: Magento Tutorial Tags: magento move, Magento database backup, magento replace domain name, Magento transplant 4,355 people BrowseAs an e-commerce shopping
Magento is developed based on PHP. To install magento locally, you must first have an environment where PHP can run. Here we recommend wampserver or XAMPP. I have tried both of them. I personally think wampserver is easy to use, we recommend that you go to the official website to download the latest version to avoid various errors caused by version problems, because I encountered the problem of updating the
Magento development Note 3. In this section, let's take a look at Layouts and Blocks in the View. Unlike other mainstream PHPMVC architectures, magento's ActionController does not pass the data object to the view or set the View object. in this section, let's take a look at Layouts and Blocks in the View.
Unlike other mainstream PHPMVC architectures, magento's ActionController does not pass data objects to views or set properties in view objects. Vi
Magento ModuleModule is the core of Magento. Any action on the site, either in the foreground or in the background, is implemented through a module. A module can be treated as a container that can contain the following items: Set (settings), database schema, render object (rendering object), Auxiliary tool Class (utility helpers), data models) or action controller (action controllers). A module can contain
In any fast iteration of the project, how to ensure the development and production (current network) database synchronization is a very headache. Magento provides a system to create a resource migration version that can help us deal with the problems that are constantly encountered during development. Www.2cto.com the last time we created the Weblogpost model. This time, we execute the create TABLE directly. We will not create a setup Resource with ou
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.