Return-Path: X-Original-To: apmail-cordova-issues-archive@minotaur.apache.org Delivered-To: apmail-cordova-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A0D821903C for ; Thu, 24 Mar 2016 23:35:26 +0000 (UTC) Received: (qmail 66203 invoked by uid 500); 24 Mar 2016 23:35:26 -0000 Delivered-To: apmail-cordova-issues-archive@cordova.apache.org Received: (qmail 66189 invoked by uid 500); 24 Mar 2016 23:35:26 -0000 Mailing-List: contact issues-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@cordova.apache.org Received: (qmail 65994 invoked by uid 99); 24 Mar 2016 23:35:25 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Mar 2016 23:35:25 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 89E8D2C1F64 for ; Thu, 24 Mar 2016 23:35:25 +0000 (UTC) Date: Thu, 24 Mar 2016 23:35:25 +0000 (UTC) From: "Samo Dadela (JIRA)" To: issues@cordova.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CB-10960) Uncaught # in write() when readyState != WRITING ? MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CB-10960?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Samo Dadela updated CB-10960: ----------------------------- Description: Excuse me if I did something stupid - I'm new to Cordova and JS. I thought that calling write() after checking readyState != WRITING would work. {code} function writeQueue(msg) { while ( !(logWriter.readyState === FileWriter.WRITING) ) { var msg = logQueue.dequeue(); if (!msg) { return; } var blob = new Blob([msg+c], { type: 'text/plain' }); logWriter.write(blob); } } } {code} But I get: 0 277161 log log writer: cdvfile://localhost/files/bala.log 1 277199 log log writer: onwriteend 2 283616 log log writer: onwriteend 3 283629 log log writer: onwriteend 4 283651 error Uncaught #, http://192.168.1.200:8100/plugins/cordova-plugin-file/www/FileWriter.js, Line: 130 Line 130 is: // Throw an exception if we are already writing a file if (this.readyState === FileWriter.WRITING) { throw new FileError(FileError.INVALID_STATE_ERR); } How can readyState change to WRITING ? Note: Queue is pure Javascript (http://code.stephenmorley.org/javascript/queues/Queue.src.js) was: Excuse me if I did something stupid - I'm new to Cordova and JS. I thought that calling write() after checking readyState != WRITING would work. function writeQueue(msg) { while ( !(logWriter.readyState === FileWriter.WRITING) ) { var msg = logQueue.dequeue(); if (!msg) { return; } var blob = new Blob([msg+c], { type: 'text/plain' }); logWriter.write(blob); } } } But I get: 0 277161 log log writer: cdvfile://localhost/files/bala.log 1 277199 log log writer: onwriteend 2 283616 log log writer: onwriteend 3 283629 log log writer: onwriteend 4 283651 error Uncaught #, http://192.168.1.200:8100/plugins/cordova-plugin-file/www/FileWriter.js, Line: 130 Line 130 is: // Throw an exception if we are already writing a file if (this.readyState === FileWriter.WRITING) { throw new FileError(FileError.INVALID_STATE_ERR); } How can readyState change to WRITING ? Note: Queue is pure Javascript (http://code.stephenmorley.org/javascript/queues/Queue.src.js) > Uncaught # in write() when readyState != WRITING ? > ------------------------------------------------------------- > > Key: CB-10960 > URL: https://issues.apache.org/jira/browse/CB-10960 > Project: Apache Cordova > Issue Type: Bug > Components: Plugin File > Affects Versions: 4.1.1 > Environment: Android > Reporter: Samo Dadela > Attachments: code.js > > > Excuse me if I did something stupid - I'm new to Cordova and JS. > I thought that calling write() after checking readyState != WRITING would work. > {code} > function writeQueue(msg) { > while ( !(logWriter.readyState === FileWriter.WRITING) ) { > var msg = logQueue.dequeue(); > if (!msg) { > return; > } > var blob = new Blob([msg+c], { type: 'text/plain' }); > logWriter.write(blob); > } > } > } > {code} > But I get: > 0 277161 log log writer: cdvfile://localhost/files/bala.log > 1 277199 log log writer: onwriteend > 2 283616 log log writer: onwriteend > 3 283629 log log writer: onwriteend > 4 283651 error Uncaught #, http://192.168.1.200:8100/plugins/cordova-plugin-file/www/FileWriter.js, Line: 130 > Line 130 is: > // Throw an exception if we are already writing a file > if (this.readyState === FileWriter.WRITING) { > throw new FileError(FileError.INVALID_STATE_ERR); > } > How can readyState change to WRITING ? > Note: Queue is pure Javascript (http://code.stephenmorley.org/javascript/queues/Queue.src.js) -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org For additional commands, e-mail: issues-help@cordova.apache.org