Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions src/data/local_storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,18 +114,20 @@ function storage(p5, fn){
*/
fn.storeItem = function(key, value) {
if (typeof key !== 'string') {
console.log(
`The argument that you passed to storeItem() - ${key} is not a string.`
p5._friendlyError(
`The argument that you passed to storeItem() - ${key} is not a string.`,
'storeItem'
);
}
if (key.endsWith('p5TypeID')) {
console.log(
`The argument that you passed to storeItem() - ${key} must not end with 'p5TypeID'.`
p5._friendlyError(
`The argument that you passed to storeItem() - ${key} must not end with 'p5TypeID'.`,
'storeItem'
);
}

if (typeof value === 'undefined') {
console.log('You cannot store undefined variables using storeItem().');
p5._friendlyError('You cannot store undefined variables using storeItem().', 'storeItem');
}
let type = typeof value;
switch (type) {
Expand Down Expand Up @@ -263,8 +265,9 @@ function storage(p5, fn){
let value = localStorage.getItem(key);
const type = localStorage.getItem(`${key}p5TypeID`);
if (typeof type === 'undefined') {
console.log(
`Unable to determine type of item stored under ${key}in local storage. Did you save the item with something other than setItem()?`
p5._friendlyError(
`Unable to determine type of item stored under ${key}in local storage. Did you save the item with something other than setItem()?`,
'getItem'
);
} else if (value !== null) {
switch (type) {
Expand Down Expand Up @@ -418,8 +421,9 @@ function storage(p5, fn){
*/
fn.removeItem = function(key) {
if (typeof key !== 'string') {
console.log(
`The argument that you passed to removeItem() - ${key} is not a string.`
p5._friendlyError(
`The argument that you passed to removeItem() - ${key} is not a string.`,
'removeItem'
);
}
localStorage.removeItem(key);
Expand Down
5 changes: 3 additions & 2 deletions src/dom/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -1832,8 +1832,9 @@ function dom(p5, fn){

// If File API's are not supported, throw Error
if (!(window.File && window.FileReader && window.FileList && window.Blob)) {
console.log(
'The File APIs are not fully supported in this browser. Cannot create element.'
p5._friendlyError(
'The File APIs are not fully supported in this browser. Cannot create element.',
'createFileInput'
);
return;
}
Expand Down
1 change: 0 additions & 1 deletion src/dom/p5.MediaElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -1170,7 +1170,6 @@ class MediaElement extends Element {
removeCue(id) {
for (let i = 0; i < this._cues.length; i++) {
if (this._cues[i].id === id) {
console.log(id);
this._cues.splice(i, 1);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/events/pointer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1861,7 +1861,7 @@ function pointer(p5, fn, lifecycles){
canvas.requestPointerLock =
canvas.requestPointerLock || canvas.mozRequestPointerLock;
if (!canvas.requestPointerLock) {
console.log('requestPointerLock is not implemented in this browser');
p5._friendlyError('requestPointerLock is not implemented in this browser', 'requestPointerLock');
return false;
}
canvas.requestPointerLock();
Expand Down
5 changes: 3 additions & 2 deletions src/image/p5.Image.js
Original file line number Diff line number Diff line change
Expand Up @@ -1605,8 +1605,9 @@ class Image {
props.displayIndex = index;
this.drawingContext.putImageData(props.frames[index].image, 0, 0);
} else {
console.log(
'Cannot set GIF to a frame number that is higher than total number of frames or below zero.'
p5._friendlyError(
'Cannot set GIF to a frame number that is higher than total number of frames or below zero.',
'setFrame'
);
}
}
Expand Down
Loading